Reputation: 103
I am new to Solr. Please help me with following queries:
What is the difference between a request handler and a query parser?
I'm thinking it's that when a query is sent through URL in solr, at first the query is parsed using the Query parser. Request handler then takes the parsed query and searches and presents the response according to request handler parameters. Is this Correct?
What is the default query parser and default request handler in Solr?
Parameter deftype is used to specify parser and qt for request handlers right?
I wrote this query
select?q=features:power%20features:latency&deftype=dismax
which works, but select?q=features:power%20features:latency&qt=dismax
does not.
Here is my requestHandler
<requestHandler name="dismax" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">dismax< /str>
<str name="echoParams">explicit< /str>
<float name="tie">0.01< /float>
<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>
<str name="pf">text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9< /str>
<str name="bf">popularity^0.5 recip(price,1,1000,1000)^0.3< /str>
<str name="fl">id,name,price,score< /str>
<str name="mm">2<-1 5<-2 6<90%< /str>
<int name="ps">100< /int>
<str name="q.alt">*:*< /str>
<!-- example highlighter config, enable per-query with hl=true
-- >
< str name="hl.fl">text features name</str>
<!-- for this field, we want no fragmenting, just highlighting
-- >
< str name="f.name.hl.fragsize">0< /str>
<!-- instructs Solr to return the field itself if no query terms are
found
-- >
<str name="f.name.hl.alternateField">name< /str>
<str name="f.text.hl.fragmenter">regex< /str>
<!-- defined below
-->
< /lst>
</requestHandler>
Upvotes: 1
Views: 3681
Reputation: 5708
Default request handler is the one with default="true" parameter in SolrConfig.xml (SearchHandler, if you haven't changed that).
Request handler handles requests, so it is a starting point for every request, which means that request handler uses/calls query parser (either the one specified by the url or default one) as its first step.
You want to get:
1. Documents with "power latency" as the phrase?
2. Or docs with both terms anywhere in a doc?
3. Or docs with either of those terms?
Try like this:
1. select?q=features:"power latency"&qt=dismax
2. select?q=features:power+features:latency&qt=dismax&mm=2
3. select?q=features:power+features:latency&qt=dismax&mm=1
More info on DisMaxQParserPlugin.
Upvotes: 3