In my Rails application I have a Question model, setup with sunspot solr, with a field “text” and I’d like to search in that field doing a logical OR between words. I’ve found that setting minimum_match to 1 solves my problem, however I’d like also to order the results by boosting questions that have more than 1 word matching. Is there a way to do this with Solr? The documentation isn’t really helpful about ranking functions.
Edit: this is the full query I’m performing in the controller
@questions = Question.solr_search do
fulltext params[:query], :minimum_match => 1
end.results
According to http://wiki.apache.org/solr/SchemaXml,
You can change your defaultOperator in solr/conf/schema.xml or you could use LocalParams to specify OR via syntax like https://github.com/sunspot/sunspot/wiki/Building-queries-by-hand
It is true Sunspot’s default operator is “AND”, as referenced in https://github.com/sunspot/sunspot/blob/master/sunspot_solr/solr/solr/conf/schema.xml