Solr i get results with dismax but not with edismax

854 Views Asked by At

when i do the same query twice one with dismax and edismax on my solr 3.6.2 debian server, i got for dismax 4 results, like expected, but for edismax 0 results.

Following you will find 3 examples that was run on the same index. This index includes a record "label:M025 Some-Example Record"

  1. Edismax with: q=M025 that hast no result.
  2. Dismax with: q=M025 that found 4 items.
  3. Edismax with: q=Example that found 1 item.

Why does EDISMAX not find "M025" but "Example"?

Solr schema

<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
        <charFilter class="solr.MappingCharFilterFactory" mapping="txt/mapping-ISOLatin1Accent.txt" />
        <tokenizer class="solr.WhitespaceTokenizerFactory" />
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="txt/stopwords.txt" enablePositionIncrements="true" />
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="0" preserveOriginal="1" />
        <filter class="solr.LowerCaseFilterFactory" />
        <filter class="solr.SnowballPorterFilterFactory" language="German2" protected="txt/protwords.txt" />
        <filter class="solr.SnowballPorterFilterFactory" language="Italian" protected="txt/protwords.txt" />
        <filter class="solr.SnowballPorterFilterFactory" language="French" protected="txt/protwords.txt" />
        <filter class="solr.RemoveDuplicatesTokenFilterFactory" />
        <filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="25" />
    </analyzer>
    <analyzer type="query">
        <charFilter class="solr.MappingCharFilterFactory" mapping="txt/mapping-ISOLatin1Accent.txt" />
        <tokenizer class="solr.WhitespaceTokenizerFactory" />
        <filter class="solr.SynonymFilterFactory" synonyms="txt/synonyms.txt" ignoreCase="true" expand="true" />
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="txt/stopwords.txt" enablePositionIncrements="true" />
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="0" preserveOriginal="1" />
        <filter class="solr.LowerCaseFilterFactory" />
        <filter class="solr.SnowballPorterFilterFactory" language="German2" protected="txt/protwords.txt" />
        <filter class="solr.SnowballPorterFilterFactory" language="Italian" protected="txt/protwords.txt" />
        <filter class="solr.SnowballPorterFilterFactory" language="French" protected="txt/protwords.txt" />
    </analyzer>
</fieldType>

<field name="label" type="text" indexed="true" stored="true" termVectors="true" omitNorms="true" required="true" />

Example EDISMAX

http://127.0.0.1:8080/solr/select?defType=edismax&qf=label&fl=label&q=M025&fq=model:Model_DbTable_Site&debugQuery=true   
<?xml version="1.0" encoding="UTF-8"?>
<response>
   <lst name="responseHeader">
      <int name="status">0</int>
      <int name="QTime">3</int>
      <lst name="params">
         <str name="fl">label</str>
         <str name="echoParams">all</str>
         <str name="qf">label</str>
         <str name="hl.fl">teaser</str>
         <str name="wt">xml</str>
         <str name="rows">25</str>
         <str name="defType">edismax</str>
         <str name="fl">label</str>
         <str name="debugQuery">true</str>
         <str name="q">M025</str>
         <str name="qf">label</str>
         <str name="fq">model:Model_DbTable_Site</str>
         <str name="defType">edismax</str>
      </lst>
   </lst>
   <result name="response" numFound="0" start="0" />
   <lst name="debug">
      <str name="rawquerystring">M025</str>
      <str name="querystring">M025</str>
      <str name="parsedquery">+DisjunctionMaxQuery((((label:m025 label:m label:025)~3)))</str>
      <str name="parsedquery_toString">+(((label:m025 label:m label:025)~3))</str>
      <lst name="explain" />
      <str name="QParser">ExtendedDismaxQParser</str>
      <null name="altquerystring" />
      <null name="boostfuncs" />
      <arr name="filter_queries">
         <str>model:Model_DbTable_Site</str>
      </arr>
      <arr name="parsed_filter_queries">
         <str>model:Model_DbTable_Site</str>
      </arr>
      <lst name="timing">
         <double name="time">2.0</double>
         <lst name="prepare">
            <double name="time">1.0</double>
            <lst name="org.apache.solr.handler.component.QueryComponent">
               <double name="time">1.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.FacetComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.HighlightComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.StatsComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.DebugComponent">
               <double name="time">0.0</double>
            </lst>
         </lst>
         <lst name="process">
            <double name="time">1.0</double>
            <lst name="org.apache.solr.handler.component.QueryComponent">
               <double name="time">1.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.FacetComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.HighlightComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.StatsComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.DebugComponent">
               <double name="time">0.0</double>
            </lst>
         </lst>
      </lst>
   </lst>
</response>

Example DISMAX

http://127.0.0.1:8080/solr/select?defType=dismax&qf=label&fl=label&q=M025&fq=model:Model_DbTable_Site&debugQuery=true   
<?xml version="1.0" encoding="UTF-8"?>
<response>
   <lst name="responseHeader">
      <int name="status">0</int>
      <int name="QTime">21</int>
      <lst name="params">
         <str name="fl">label</str>
         <str name="echoParams">all</str>
         <str name="qf">label</str>
         <str name="hl.fl">teaser</str>
         <str name="wt">xml</str>
         <str name="rows">25</str>
         <str name="defType">dismax</str>
         <str name="fl">label</str>
         <str name="debugQuery">true</str>
         <str name="q">M025</str>
         <str name="qf">label</str>
         <str name="fq">model:Model_DbTable_Site</str>
         <str name="defType">dismax</str>
      </lst>
   </lst>
   <result name="response" numFound="4" start="0">
      <doc>
         <str name="label">M025 Some-Example Record</str>
      </doc>
      <doc>
         <str name="label">S025 ******************</</str>
      </doc>
      <doc>
         <str name="label">ES025 ******************</str>
      </doc>
      <doc>
         <str name="label">WK025 ******************</</str>
      </doc>
   </result>
   <lst name="debug">
      <str name="rawquerystring">M025</str>
      <str name="querystring">M025</str>
      <str name="parsedquery">+DisjunctionMaxQuery(((label:m025 label:m label:025))) ()</str>
      <str name="parsedquery_toString">+((label:m025 label:m label:025)) ()</str>
      <lst name="explain">
         <str name="Model_DbTable_Site_1">4.7416363 = (MATCH) sum of:
  4.7416363 = (MATCH) product of:
    7.112454 = (MATCH) sum of:
      3.277886 = (MATCH) weight(label:m025 in 7440), product of:
        0.4947139 = queryWeight(label:m025), product of:
          6.625821 = idf(docFreq=27, maxDocs=7770)
          0.07466454 = queryNorm
        6.625821 = (MATCH) fieldWeight(label:m025 in 7440), product of:
          1.0 = tf(termFreq(label:m025)=1)
          6.625821 = idf(docFreq=27, maxDocs=7770)
          1.0 = fieldNorm(field=label, doc=7440)
      3.834568 = (MATCH) weight(label:025 in 7440), product of:
        0.44994345 = queryWeight(label:025), product of:
          6.0262 = idf(docFreq=50, maxDocs=7770)
          0.07466454 = queryNorm
        8.522333 = (MATCH) fieldWeight(label:025 in 7440), product of:
          1.4142135 = tf(termFreq(label:025)=2)
          6.0262 = idf(docFreq=50, maxDocs=7770)
          1.0 = fieldNorm(field=label, doc=7440)
    0.6666667 = coord(2/3)</str>
         <str name="Model_DbTable_Site_239">1.2781894 = (MATCH) sum of:
  1.2781894 = (MATCH) product of:
    3.834568 = (MATCH) sum of:
      3.834568 = (MATCH) weight(label:025 in 428), product of:
        0.44994345 = queryWeight(label:025), product of:
          6.0262 = idf(docFreq=50, maxDocs=7770)
          0.07466454 = queryNorm
        8.522333 = (MATCH) fieldWeight(label:025 in 428), product of:
          1.4142135 = tf(termFreq(label:025)=2)
          6.0262 = idf(docFreq=50, maxDocs=7770)
          1.0 = fieldNorm(field=label, doc=428)
    0.33333334 = coord(1/3)</str>
         <str name="Model_DbTable_Site_61">1.2781894 = (MATCH) sum of:
  1.2781894 = (MATCH) product of:
    3.834568 = (MATCH) sum of:
      3.834568 = (MATCH) weight(label:025 in 83), product of:
        0.44994345 = queryWeight(label:025), product of:
          6.0262 = idf(docFreq=50, maxDocs=7770)
          0.07466454 = queryNorm
        8.522333 = (MATCH) fieldWeight(label:025 in 83), product of:
          1.4142135 = tf(termFreq(label:025)=2)
          6.0262 = idf(docFreq=50, maxDocs=7770)
          1.0 = fieldNorm(field=label, doc=83)
    0.33333334 = coord(1/3)</str>
         <str name="Model_DbTable_Site_51">1.2781894 = (MATCH) sum of:
  1.2781894 = (MATCH) product of:
    3.834568 = (MATCH) sum of:
      3.834568 = (MATCH) weight(label:025 in 43), product of:
        0.44994345 = queryWeight(label:025), product of:
          6.0262 = idf(docFreq=50, maxDocs=7770)
          0.07466454 = queryNorm
        8.522333 = (MATCH) fieldWeight(label:025 in 43), product of:
          1.4142135 = tf(termFreq(label:025)=2)
          6.0262 = idf(docFreq=50, maxDocs=7770)
          1.0 = fieldNorm(field=label, doc=43)
    0.33333334 = coord(1/3)</str>
      </lst>
      <str name="QParser">DisMaxQParser</str>
      <null name="altquerystring" />
      <null name="boostfuncs" />
      <arr name="filter_queries">
         <str>model:Model_DbTable_Site</str>
      </arr>
      <arr name="parsed_filter_queries">
         <str>model:Model_DbTable_Site</str>
      </arr>
      <lst name="timing">
         <double name="time">21.0</double>
         <lst name="prepare">
            <double name="time">1.0</double>
            <lst name="org.apache.solr.handler.component.QueryComponent">
               <double name="time">1.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.FacetComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.HighlightComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.StatsComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.DebugComponent">
               <double name="time">0.0</double>
            </lst>
         </lst>
         <lst name="process">
            <double name="time">20.0</double>
            <lst name="org.apache.solr.handler.component.QueryComponent">
               <double name="time">18.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.FacetComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.HighlightComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.StatsComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.DebugComponent">
               <double name="time">2.0</double>
            </lst>
         </lst>
      </lst>
   </lst>
</response>

Example EDISMAX with name

http://127.0.0.1:8080/solr/select?defType=edismax&qf=label&fl=label&q=Example&fq=model:Model_DbTable_Site&debugQuery=true
<?xml version="1.0" encoding="UTF-8"?>
<response>
   <lst name="responseHeader">
      <int name="status">0</int>
      <int name="QTime">1</int>
      <lst name="params">
         <str name="fl">label</str>
         <str name="echoParams">all</str>
         <str name="qf">label</str>
         <str name="hl.fl">teaser</str>
         <str name="wt">xml</str>
         <str name="rows">25</str>
         <str name="defType">edismax</str>
         <str name="fl">label</str>
         <str name="debugQuery">true</str>
         <str name="q">Example</str>
         <str name="qf">label</str>
         <str name="fq">model:Model_DbTable_Site</str>
         <str name="defType">edismax</str>
      </lst>
   </lst>
   <result name="response" numFound="1" start="0">
      <doc>
         <str name="label">M025 Some-Example Record</str>
      </doc>
   </result>
   <lst name="debug">
      <str name="rawquerystring">Example</str>
      <str name="querystring">Example</str>
      <str name="parsedquery">+DisjunctionMaxQuery((label:example))</str>
      <str name="parsedquery_toString">+(label:example)</str>
      <lst name="explain">
         <str name="Model_DbTable_Site_1">9.264878 = (MATCH) fieldWeight(label:example in 7440), product of:
  1.0 = tf(termFreq(label:example)=1)
  9.264878 = idf(docFreq=1, maxDocs=7770)
  1.0 = fieldNorm(field=label, doc=7440)</str>
      </lst>
      <str name="QParser">ExtendedDismaxQParser</str>
      <null name="altquerystring" />
      <null name="boostfuncs" />
      <arr name="filter_queries">
         <str>model:Model_DbTable_Site</str>
      </arr>
      <arr name="parsed_filter_queries">
         <str>model:Model_DbTable_Site</str>
      </arr>
      <lst name="timing">
         <double name="time">1.0</double>
         <lst name="prepare">
            <double name="time">0.0</double>
            <lst name="org.apache.solr.handler.component.QueryComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.FacetComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.HighlightComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.StatsComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.DebugComponent">
               <double name="time">0.0</double>
            </lst>
         </lst>
         <lst name="process">
            <double name="time">1.0</double>
            <lst name="org.apache.solr.handler.component.QueryComponent">
               <double name="time">1.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.FacetComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.HighlightComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.StatsComponent">
               <double name="time">0.0</double>
            </lst>
            <lst name="org.apache.solr.handler.component.DebugComponent">
               <double name="time">0.0</double>
            </lst>
         </lst>
      </lst>
   </lst>
</response>
1

There are 1 best solutions below

0
On

Right after writing this i found the solution.

I`am not realy shure why DISMAX found anything but the problem is the name. Original in my schema was:

<filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="25" />

And in parsed query is

+DisjunctionMaxQuery((((label:m025 label:m label:025)~3)))

So the letters and numbers will be splitted so one ngram was "m" and the second was "025" Because the "m" length was < 2 it has been ignored.

After change to

<filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="25" />

I got the result what i expected.