0

I have a solr query that searches on multiple fields. To increase the recall, I also do wildcard and fuzzy query. I use edismax query parser because I also have to use boost function.

Here is the relevant parts of the query:

defType=edismax&q= (wine AND company) OR  (wine* AND company*)^0.5  OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02&qf=primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5

Now, the above query searches for (wine AND company) OR (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 OR (wine~1 AND company~1)^0.02 on all the fields primary_tags^1 secondary_tags_s^0.2 merchant_name_s^0.5, but what I want is that (wine AND company) should only be searched on merchant_name_s^0.5, (wine* AND company*)^0.5 OR (wine* OR company*)^0.01 on primary_tags^1 and (wine~1 AND company~1)^0.02 on secondary_tags_s^0.2.

What would be the correct way to achieve that?

vishalaksh
  • 2,054
  • 5
  • 27
  • 45

1 Answers1

0

edismax supports the full Lucene syntax.

q=merchant_name:(wine AND company)^0.5 primary_tags:(wine* AND company*)^0.5 primary_tags:(wine* OR company*)^0.01 secondary_tags_s:(wine~1 AND company~1)^0.0004

should be about the same query you've described. I've combined the secondary_tags_s part into one single weight and seprated the primary_tags clauses, since the default behavior is OR between the terms anyway (depending on q.op).

MatsLindh
  • 49,529
  • 4
  • 53
  • 84