Multiple Boost Queries in Solr

edismax, solr

Solution

Re-worked the handler from scratch. Here's how I achieved the desired results:

<requestHandler name="/search" class="solr.SearchHandler">
<lst name="defaults">
    <str name="indent">false</str>      
    <str name="echoParams">explicit</str>
    <str name="defType">edismax</str>
    <str name="qf">
        Title^10.0 Detail CategoryTrail^4.0 
    </str>
    <str name="mm">1</str>
    <str name="pf">Title^8.0 Detail</str>
    <str name="bq">_val_:"{!edismax qf=$boostQueryQf mm=100% v=$q bq=}"^100</str>
    <str name="boostQueryQf">Title^10.0 Detail</str>
    <str name="bq">CatTrail:Laptops/*^50.0</str>
    <str name="bq">ReviewCount:[1 TO *]^4.0</str>
    <str name="bf">recip(ms(NOW,DateAdded),3.16e-11,1,1)^4.0</str>
    <int name="rows">10</int>
    <str name="df">allText</str>
</lst>
</requestHandler>

I don't think I was too specific in my demands. It's a general requirements for a E-Commerce search where they would like to boost records with exact search keywords, a few specific categories, products with reviews and newer results. I would recommend the above approach which I achieved through a lot of research and Hit & trials.

Problem

I need to have multiple bq for a query. Here's the configuration for request handler. ``` <requestHandler name="/search" class="solr.StandardRequestHandler"> <lst name="defaults"> <str name="indent">false</str> <str name="q"> _query_:"{!edismax qf=$qfQuery mm=$mmQuery pf=$pfQuery bq=$boostQuery bq=$bQuery v=$mainQuery}" </str> <str name="qfQuery">Title^10.0 Detail CategoryTrail^4.0</str> <str name="mmQuery">1</str> <str name="pfQuery">Title Detail</str> <str name="boostQuery"> _query_:"{!edismax qf=$boostQueryQf mm=100% v=$mainQuery}"^100</str> <str name="boostQueryQf">Title Detail</str> <str name="bQuery">_query_:"{!edismax qf=$bQueryQf v=$mainQuery}"</str> <str name="bQueryQf">CatTrail:Laptops/*^50.0 recip(ms(NOW,DateAdded),3.16e-11,1,1)^4.0 Availability:True^4.0 !ReviewCount:0^2.0</str> </lst> </requestHandler> ``` Sadly, none of the bq affects the results. I can't see any `boost_queries` in the debugQuery output. I have also tried putting a blank bq in both `boostQuery` and `bQuery` as suggested on the web. But that didn't work either. Can anyone fix this handler or provide me an alternative for the desired result? Thanks in advance.

Original source