searchsolrluceneinformation-retrievaledismax

SOLR 6.6 eDisMax query not respecting mm parameter


I am using Solr 6.6.2 and up until now we were using the DisMax query along with the mm parameter, and it works just as expected. A small example

defType=dismax&q=samsung+iphone&qf=name+brand&mm=1 would return a result set as expected, containing both iPhones, and Samsung products. However when do the exact same thing, just replace the defType to defType=edismax (keeping the mm=1) there is no result returned. I have read the documentation of the eDisMax query parser at the Apache SOLR reference and it clearly says the eDisMax is an extension so I expect the mm to behave the same in both DisMax and eDisMax, also if you scroll down on the same page, the documentation also gives an example of the mm parameter that should work as I expect. Is this a bug, or am I missing something very obvious? Love some help here

EDIT Adding the solr params that are sent along with the request

eDisMax

{
  "responseHeader":{
    "zkConnected":true,
    "status":0,
    "QTime":0,
    "params":{
      "mm":"1",
      "q":"samsung iphone",
      "defType":"edismax",
      "indent":"on",
      "fl":"name, category_names, score",
      "fq":"channel:outbound",
      "wt":"json",
      "_":"1515855895772"}},
  "response":{"numFound":0,"start":0,"maxScore":0,"docs":[]
  }}

DisMax

{
  "responseHeader":{
    "zkConnected":true,
    "status":0,
    "QTime":22,
    "params":{
      "mm":"1",
      "q":"samsung iphone",
      "defType":"dismax",
      "indent":"on",
      "fl":"name, category_names, score",
      "fq":"channel:outbound",
      "wt":"json",
      "_":"1515855895772"}},
  "response":{"numFound":2147,"start":0,"maxScore":12.172616,"docs":[
      {
        "name":"Apple iPhone 5s",
        "score":12.172616},...]
}}

Solution

  • Not sure if anyone else faced this issue or not, but I feel it was not well documented. Our Solr q.op defaults to AND and so a search term like "foo bar car" was searched as foo AND bar AND cat. Now with mm=2 and defType=dismax the query was losely parsed to (foo AND bar AND cat)~2 so far so good..

    When I change the defType=edismax the same query "foo bar cat" and mm=2 was parsed as (foo AND bar AND cat) NOTE: the missing ~2.

    Now if I go ahead and add q.op=OR interesting things start to happen. The parsed query now looks like (foo bar cat)~2 this is exactly what the dismax does. So you could understand (foo bar cat)~2 find me at least 2 of these terms. If I remove the mm parameter, the parsed query looks like (foo bar cat) and since the q.op=OR it returns any document that contains any of the 3 terms.

    Either ways, it doesn't really matter and the same behavior can be achieved, its just confusing that the behavior between disMax and eDisMax is somewhat inconsistent.

    Hope this helps someone else.