Sphinx,为每条记录设置精确匹配?
所以我最近一直在 Rails 项目中使用 Sphinx,我想提供一个“将是”与给定术语 100% 匹配的精确匹配列表。例如:
+==================+==========================================================+
| ingredient | exact matches |
+==================+==========================================================+
| cheese, cream | 'cream cheese','philadephia cream cheese','cream chese',|
| | 'creamed cheese' |
+------------------+----------------------------------------------------------+
| Cheese, gruyere | 'gruyere','gruyer cheese','gruyeres cheese' |
| | 'gruyere chese' |
+------------------+----------------------------------------------------------+
| Cheese, blue | 'blue cheese','blu cheese' |
+------------------+----------------------------------------------------------+
所以基本上我正在寻找的功能是 Sphinx 会尝试对所有记录进行典型匹配,但是如果搜索项与该记录中数组中的字符串之一完全匹配,则结果会有更高的重量。 (比如 100x,所以这将是最佳匹配)
这可能吗?似乎其他人以前也会遇到这个问题......不是吗?
更新
我认为最好的答案可能是只索引完全匹配
列并为术语提供非常高的权重。
我不确定如何分解“数组”并查看搜索词是否完全匹配......
So I've been using Sphinx with a rails project lately, I want to provide a list of 'would be' exact matches that would match 100% with a give term. For example something like:
+==================+==========================================================+
| ingredient | exact matches |
+==================+==========================================================+
| cheese, cream | 'cream cheese','philadephia cream cheese','cream chese',|
| | 'creamed cheese' |
+------------------+----------------------------------------------------------+
| Cheese, gruyere | 'gruyere','gruyer cheese','gruyeres cheese' |
| | 'gruyere chese' |
+------------------+----------------------------------------------------------+
| Cheese, blue | 'blue cheese','blu cheese' |
+------------------+----------------------------------------------------------+
So basically the functionality I'm looking for would be that Sphinx would try to do its typical matching on all the records, but if the search term matches exactly with one of the strings in an array in that record that result would have a much higher weight. (like 100x, so it would then be the best match)
Is this possible? It seems like other people would have had this problem before... no?
Update
I suppose the best answer might be to just index the exact matches
column and provide a really high weight to the terms.
I'm not sure how I can break up the "array" and see if the search term matches exactly though...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该尝试使用 sphinx 搜索模式。查看匹配短语和匹配扩展2。
Your should try to play with sphinx search modes. Look at match phrase and match extended2.