tags:

views:

29

answers:

0

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...

related questions