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...
Your should try to play with sphinx search modes. Look at match phrase and match extended2.
精彩评论