2

Due to lack of proper documentation , I am unable to figure out on how to use the dismaxRequestHandler with SolrJ.

On another note , is the standard request handler ,the default in SolrJ's implementation ?

javanna
  • 59,145
  • 14
  • 144
  • 125
A Null Pointer
  • 2,261
  • 3
  • 26
  • 28

1 Answers1

2

The default="true" in solrconfig.xml decides which is the default request handler. In the examples with solr, the standard request handler is the default.

<requestHandler name="search" class="solr.SearchHandler" default="true">
.....
</requestHandler>

You can easily map this attribute to the other request handlers to make them default.

Example with edismax -

<requestHandler name="/browse" class="solr.SearchHandler" default="true">
 <lst name="defaults">
   <str name="echoParams">explicit</str>
   <str name="defType">edismax</str>
   <str name="q.alt">*:*</str>
   <str name="rows">10</str>
   <str name="fl">*,score</str>
   <str name="qf">
      text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
   </str>
 </lst>
</requestHandler>

The qt parameter can be used with Solrj to query through specific request handler.

Example for Solrj -

CommonsHttpSolrServer commonsHttpSolrServer = new CommonsHttpSolrServer("solr_path_url");
commonsHttpSolrServer.setParser(new XMLResponseParser());
ModifiableSolrParams params = new ModifiableSolrParams();
// Specify the Request handler
params.add("qt", "dismax_request_handler");
params.add("q", "query_string");
QueryResponse response = commonsHttpSolrServer.query(params);
Jayendra
  • 52,349
  • 4
  • 80
  • 90
  • Thanks for the help. I should have clarified it previously , I am using Solr 1.4 and edismax as I know is enabled only after 3.1. Will the same settings work for Solr1.4 as well where the requestHandler is just dismax ? Also should I worry about commenting out the " text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9" stuff ? – A Null Pointer Nov 15 '11 at 08:48
  • 1
    yes .. just change the edismax to dismax and everything else should work fine. You can comment pf which are basically boost for phrase matches to start with and then fin tune your relevancy. – Jayendra Nov 15 '11 at 09:09