I am using sunspot_rails
to submit queries to a Solr
instance. Everything works ok, but I want to order my results with the following criteria: I want to take first the documents where the matching term appears as word rather than as part of a word.
Hence, if I have the two documents:
1) Solr searching with Solr is fantastic
and
2) Solr is very good to support search with free text
and the term I am looking for is : search
, then
I want to take both documents in the results, but I want document (2) to appear first.
I have tried order_by :score, :desc
but it does not seem to be working. Unless I find a way to tell how the "score" is calculated.
Thanks in advance Panayotis
search~1
for exact match. Other than that, i guess that you'll have to mess with solr filters / tokenizers to prevent stemming, but i'm not sure how. – m_x