3

I'm getting this error NoMethodError: undefined method 'any' for #<Sunspot::DSL::Search:0x000000037a8070>

when I try to do like as per documentation. https://github.com/sunspot/sunspot#disjunctions-and-conjunctions

Post.search do
  any do
    fulltext "keyword1", :fields => :title
    fulltext "keyword2", :fields => :body
  end
end

I'm using latest version of sunspot 2.1.1. I'm using defaultOperator="OR" in my schema xml and I want to AND both the results. It works if I could add AND between both queries using adjust_solr_params but I have many more conditions like e.g boosting exact match and other part, checking into specific text field. I want to achieve the boosting the records with exact matches and also it should give ngram results as well. So currently ngram results are not giving because of ANDing with exact matches results. Any suggestion how can I achieve this.

Data Don
  • 338
  • 2
  • 11

1 Answers1

0

According to this issue any|all was added after 2.1.1 release.

The documentation for your version does not have these methods: https://github.com/sunspot/sunspot/tree/v2.1.1

So, in order to use any|all you should use the edge version or to wait for the next release.

notdang
  • 500
  • 2
  • 8