SOLR mm and phrase queries not working after upgra

2019-07-29 04:33发布

问题:

I'm working on testing a new SOLR 6 server (6.2.0), as we have been running 4.3.1 for some time, and it was time for an upgrade.

One thing I've noticed is that the mm (minMatch) term does not seem to work the way it used to (or it's being ignored), and phrase searches are not working properly either.

For example, searching for "tabletop scanning electron microscope" (including quotes) in our index should return two matching documents, but I get zero matches.

The search is set to use edismax.

Here's some of the debug output, in case this is helpful:

"responseHeader": {
"status": 0,
"QTime": 1,
"params": {
"mm": "4<-1 6<80%",
"q": "\"tabletop scanning electron microscope\"",
"qt": "dismaxsearch",
"indent": "on",
"pf": "headline^3.0 adtextintro^2.0 adtext^1.5",
"q.op": "OR",
"wt": "json",
"debugQuery": "true"
}
},
"response": {
"numFound": 0,
"start": 0,
"docs": []
},
"debug": {
"rawquerystring": "\"tabletop scanning electron microscope\"",
"querystring": "\"tabletop scanning electron microscope\"",
"parsedquery": "PhraseQuery(adtext:\"tabletop scan electron microscop\")",
"parsedquery_toString": "adtext:\"tabletop scan electron microscop\"",
"explain": {},
"QParser": "LuceneQParser",

The same search, but without the quotes, returns either far too many results when using q.op=OR, or zero results when using q.op=AND. Again, it seems that mm is ignored when using OR. When using AND, there should be two matches.

Any suggestions? From what I've read so far, it seems there is a change in the way q.op works, but I have not been able to get things to work regardless of how I adjust this.

Please let me know if more details are required.


After more testing, I'm finding that the "qf" defined in my config is being ignored. Or, possibly the entire searcher config is ignored.

Here's the config in my solrconfig.xml file:

    <requestHandler name="dismaxsearch" class="solr.SearchHandler" default="true">
 <lst name="defaults">
   <str name="echoParams">explicit</str>
   <str name="defType">edismax</str>
   <float name="tie">0.01</float>
   <str name="qf">
      headline^3.0 manufacturer^1.0 model^1.0 adtextintro^2.0 adtext^1.5 companyname^0.2 clientnumber^20
   </str>
   <str name="bq">islvad:0^1.8</str>
   <!-- <str name="bf">recip(lvqualityrank,1,1000000,500)</str>-->
   <str name="bf">recip(lvqualityrankadjusted,1,5000000,50)</str>
   <!-- <str name="bf">product(lvqualityrank,-1)</str>-->
   <str name="q.alt">*:*</str>
   <str name="fl">*,score</str>
   <str name="rows">200</str>
   <str name="boost">recip(ms(NOW/HOUR,addate),3.16e-11,0.08,0.03)</str>
 </lst>
</requestHandler>

This all worked in SOLR4, but possibly I've done something incorrect when migrating the config to SOLR6...

Thanks,

Bill

回答1:

Your request dispatcher certainly has the param handleSelect=true (default and recommended for backward compatibility), in this case you need to ensure no request handler named "/select" is defined (solrconfig.xml), otherwise /select will actually handle the request regardless of the qt param.

handleSelect is a legacy option that affects the behavior of requests such as /select?qt=XXX

handleSelect="true" will cause the SolrDispatchFilter to process the request and dispatch the query to a handler specified by the "qt" param, assuming "/select" isn't already registered.

But if handleSelect is set to false, then the invoked request handler is determined by the request path (not qt). In this case, a request like http://.../select?q=... is dispatched to /select handler.

So there is 2 options :

  • With handleSelect="true": just comment out /select handler definition and use the qt param to specify wich request handler to use.
  • With handleSelect="false": specify the request handler in the request path (.../dismaxsearch?q=...). But this requires renaming your request handler to "/dismaxsearch".

The first option is usually prefered and is maybe the most appropriate for those who want to be able to change request handler "on the fly", using a param is more instinctive and logical than changing path.



标签: solr