Sphinx 类似句子的查询

发布于 2024-10-03 14:05:59 字数 245 浏览 3 评论 0原文


我的任务是在数据库集合中找到类似的句子。

您能建议我使用哪种查询类型吗?

样本: 搜索: 欢迎使用第一个示例代码。

假设以下句子适合我的查询:

Dbase:

...

欢迎首先电影...

这是第一个示例代码...

欢迎! ...

谢谢

my task is to find a similar sentence in database collection.

Could you advise me which query type to use?

Sample:
Search: Welcome to the first sample code.

And let say the following sentences are fine for my query:

Dbase:

...

Welcome in first movie ...

This is first sample code ...

Welcome!
...

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

似梦非梦 2024-10-10 14:05:59

如果我猜对了,那么数据库中的每个句子(包含搜索查询中的一个或多个单词)都没有问题。

在这种情况下,您必须使用 SPH_MATCH_ANY 模式或 SPH_MATCH_EXTENDED2| (OR) 运算符。

匹配模式...

扩展查询语法...

如果您想排除“to”、“the”等词短单词,您有多种选择:

1) 如果您确定应排除每个少于 4 个字母的单词,请将以下行添加到您的 sphinx.conf 文件中:

min_word_len = 4

阅读更多...

2) 如果您想排除特定单词,使用停用词文件。

将以下行添加到 sphinx.conf

#path to txt file with words to be excluded (space separated)
stopwords = /usr/local/sphinx/configuration/stopwords.txt   

阅读更多...

您应该知道的最后一件事是,我只是提供了非常基本的内容,这些内容在文档中进行了清楚的解释,我的示例也取自那里。

If I got it correctly, each sentence in the DB, which includes one or more words from the search query, is fine.

In this case, you have to use the SPH_MATCH_ANY mode or SPH_MATCH_EXTENDED2 with | (OR) operator.

Matching modes...

Extended query syntax...

If you want to exclude such words as "to", "the" and other short words, you have several options:

1) If you are sure that each word which is less than 4 letters should be excluded, add the following line to your sphinx.conf file:

min_word_len = 4

Read more...

2) if you want to exclude specific words, use the stopwords file(s).

Add the following lines to sphinx.conf:

#path to txt file with words to be excluded (space separated)
stopwords = /usr/local/sphinx/configuration/stopwords.txt   

Read more...

And the last thing you should know is that I just provided very basic things which are clearly explained in the documentation and my examples are also taken from there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文