6

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.

ThePCWizard
  • 3,338
  • 2
  • 21
  • 32
  • Just to clarify - can you see those queries in `parsedquery` in debugQuery output, at least partially applied? They probably will be in a processed form already, so don't look for exact match there. – rchukh Nov 27 '13 at 00:30
  • @rchukh No, not even partially. Here's the output of parsedquery `(+DisjunctionMaxQuery((((CategoryTrail:battery CategoryTrail:batteries)^4.0) | (Detail:battery Detail:batteries) | ((Title:battery Title:batteries)^10.0))) () () ((+())/no_coord))/no_coord` – ThePCWizard Nov 27 '13 at 06:24

1 Answers1

12

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.

ThePCWizard
  • 3,338
  • 2
  • 21
  • 32