Sphinx 类似句子的查询
我的任务是在数据库集合中找到类似的句子。
您能建议我使用哪种查询类型吗?
样本: 搜索: 欢迎使用第一个示例代码。
假设以下句子适合我的查询:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我猜对了,那么数据库中的每个句子(包含搜索查询中的一个或多个单词)都没有问题。
在这种情况下,您必须使用
SPH_MATCH_ANY
模式或SPH_MATCH_EXTENDED2
和|
(OR) 运算符。匹配模式...
扩展查询语法...
如果您想排除“to”、“the”等词短单词,您有多种选择:
1) 如果您确定应排除每个少于 4 个字母的单词,请将以下行添加到您的
sphinx.conf
文件中:阅读更多...
2) 如果您想排除特定单词,使用停用词文件。
将以下行添加到
sphinx.conf
:阅读更多...
您应该知道的最后一件事是,我只是提供了非常基本的内容,这些内容在文档中进行了清楚的解释,我的示例也取自那里。
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 orSPH_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:Read more...
2) if you want to exclude specific words, use the stopwords file(s).
Add the following lines to
sphinx.conf
: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.