Because you used solr.StandardTokenizerFactory which will tokenize terms at some delimiters - such as the hyphens that surround your errant 404 case.

Try solr.WhitespaceTokenizerFactory or solr.KeywordTokenizerFactory.

And maybe rename your field type from "text_general_trim" to "text_exact" since "general" implies a general text analyzer.

Test your field type changes on the Solr Admin Analysis page.

-- Jack Krupansky

-----Original Message----- From: geeky2
Sent: Friday, October 19, 2012 5:20 PM
To: solr-user@lucene.apache.org
Subject: need help with exact match search

environment: solr 3.5

Hello,

i have a query for an exact match that is bringing back one (1) additional
record that is NOT an exact match.

when i do an exact match search for 404 - i should get back three (3)
document, *but i get back the additional record, with an
itemModelNoExactMatchStr of DUS-404-19                  *

can someone help me understand what i am missing or not setting up
correctly?


response from solr with 4 documents

<?xml version="1.0"?>
<response>
 <lst name="responseHeader">
   <int name="status">0</int>
   <int name="QTime">1</int>
   <lst name="params">
     <str name="sort">itemModelNoExactMatchStr asc</str>
     <str name="fq">itemType:2</str>
     <str name="echoParams">all</str>
     <str name="qf">itemModelNoExactMatchStr^30.0</str>
     <str name="q.alt">*:*</str>
     <str name="rows">50</str>
     <str name="defType">edismax</str>
     <str name="debugQuery">true</str>
   *  <str name="q">itemModelNoExactMatchStr:404</str>*
     <str name="qt">modelItemNoSearch</str>
     <str name="rows">50</str>
     <str name="facet">false</str>
   </lst>
 </lst>
 *<result name="response" numFound="4" start="0">*
   <doc>
     <arr name="divProductTypeDesc">
       <str>Kitchen Equipment*</str>
     </arr>
     <str name="divProductTypeId">0212020</str>
     <str name="id">0212020,0431  ,404
</str>
     <str name="itemModelDesc">ELECTRIC GENERAL SLICER WITH VACU BASE</str>
    * <str name="itemModelNo">404                                </str>*
     <str name="itemModelNoExactMatchStr">404
</str>
     <int name="itemType">2</int>
     <int name="partCnt">13</int>
     <arr name="plsBrandDesc">
       <str>GENERAL</str>
     </arr>
     <str name="plsBrandId">0431  </str>
     <int name="rankNo">0</int>
   </doc>
   <doc>
     <arr name="divProductTypeDesc">
       <str>Vacuum, Canister</str>
     </arr>
     <str name="divProductTypeId">0642000</str>
     <str name="id">0642000,0517  ,404
</str>
     <str name="itemModelDesc">HOOVER </str>
     <str name="itemModelNo">404                                </str>
    * <str name="itemModelNoExactMatchStr">404
</str>*
     <int name="itemType">2</int>
     <int name="partCnt">48</int>
     <arr name="plsBrandDesc">
       <str>HOOVER</str>
     </arr>
     <str name="plsBrandId">0517  </str>
     <int name="rankNo">0</int>
   </doc>
   <doc>
     <arr name="divProductTypeDesc">
       <str>Power roller</str>
     </arr>
     <str name="divProductTypeId">0733200</str>
     <str name="id">0733200,1164  ,404
</str>
     <str name="itemModelDesc">POWER PAINTER</str>
     <str name="itemModelNo">404                                </str>
    * <str name="itemModelNoExactMatchStr">404
</str>*
     <int name="itemType">2</int>
     <int name="partCnt">39</int>
     <arr name="plsBrandDesc">
       <str>WAGNER</str>
     </arr>
     <str name="plsBrandId">1164  </str>
     <int name="rankNo">0</int>
   </doc>
   <doc>
     <arr name="divProductTypeDesc">
       <str>Dishwasher^</str>
     </arr>
     <str name="divProductTypeId">0130000</str>
     <str name="id">0130000,0164  ,DUS-404-19
</str>
     <str name="itemModelDesc">DISHWASHERS</str>
     <str name="itemModelNo">DUS-404-19                         </str>
     *<str name="itemModelNoExactMatchStr">DUS-404-19
</str>*
     <int name="itemType">2</int>
     <int name="partCnt">185</int>
     <arr name="plsBrandDesc">
       <str>CALORIC</str>
     </arr>
     <str name="plsBrandId">0164  </str>
     <int name="rankNo">0</int>
   </doc>
 </result>
 <lst name="debug">
   <str name="rawquerystring">itemModelNoExactMatchStr:404</str>
   <str name="querystring">itemModelNoExactMatchStr:404</str>
   <str name="parsedquery">+itemModelNoExactMatchStr:404</str>
   <str name="parsedquery_toString">+itemModelNoExactMatchStr:404</str>
   <lst name="explain">
     <str name="0212020,0431  ,404                                ">
10.053003 = (MATCH) fieldWeight(itemModelNoExactMatchStr:404 in 4745495),
product of:
 1.0 = tf(termFreq(itemModelNoExactMatchStr:404)=1)
 10.053003 = idf(docFreq=971, maxDocs=8304922)
 1.0 = fieldNorm(field=itemModelNoExactMatchStr, doc=4745495)
</str>
     <str name="0642000,0517  ,404                                ">
10.053003 = (MATCH) fieldWeight(itemModelNoExactMatchStr:404 in 4781972),
product of:
 1.0 = tf(termFreq(itemModelNoExactMatchStr:404)=1)
 10.053003 = idf(docFreq=971, maxDocs=8304922)
 1.0 = fieldNorm(field=itemModelNoExactMatchStr, doc=4781972)
</str>
     <str name="0733200,1164  ,404                                ">
10.053003 = (MATCH) fieldWeight(itemModelNoExactMatchStr:404 in 8186768),
product of:
 1.0 = tf(termFreq(itemModelNoExactMatchStr:404)=1)
 10.053003 = idf(docFreq=971, maxDocs=8304922)
 1.0 = fieldNorm(field=itemModelNoExactMatchStr, doc=8186768)
</str>
     <str name="0130000,0164  ,DUS-404-19                         ">
5.0265017 = (MATCH) fieldWeight(itemModelNoExactMatchStr:404 in 4665718),
product of:
 1.0 = tf(termFreq(itemModelNoExactMatchStr:404)=1)
 10.053003 = idf(docFreq=971, maxDocs=8304922)
 0.5 = fieldNorm(field=itemModelNoExactMatchStr, doc=4665718)
</str>
   </lst>
   <str name="QParser">ExtendedDismaxQParser</str>
   <null name="altquerystring"/>
   <null name="boostfuncs"/>
   <arr name="filter_queries">
     <str>itemType:2</str>
   </arr>
   <arr name="parsed_filter_queries">
     <str>itemType:2</str>
   </arr>
   <lst name="timing">
     <double name="time">1.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">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>
 </lst>
</response>




i have looked at some of the threads up here related to this topic, but
still do not understand why the additional document is coming back.

here is my query:

http://someserver/somecore/select?qt=modelItemNoSearch&q=itemModelNoExactMatchStr:404&debugQuery=true&rows=50


here is my RH from the solrconfig.xml

 <requestHandler name="modelItemNoSearch" class="solr.SearchHandler"
default="false">
   <lst name="defaults">
     <str name="defType">edismax</str>
     <str name="echoParams">all</str>
     <int name="rows">10</int>
     <str name="qf">itemModelNoExactMatchStr^30.0</str>
     <str name="q.alt">*:*</str>
   </lst>
   <lst name="appends">
     <str name="fq">itemType:2</str>
     <str name="sort">itemModelNoExactMatchStr asc</str>
   </lst>
   <lst name="invariants">
     <str name="facet">false</str>
   </lst>
 </requestHandler>


here is the field, copyField and text type from schema.xml

   <field name="itemModelNoExactMatchStr" type="text_general_trim"
indexed="true" stored="true"/>
<copyField source="itemModelNo" dest="itemModelNoExactMatchStr"/>

   <fieldType name="text_general_trim" class="solr.TextField"
positionIncrementGap="100">
     <analyzer type="index">
       <tokenizer class="solr.StandardTokenizerFactory"/>
       <filter class="solr.LowerCaseFilterFactory"/>
       <filter class="solr.TrimFilterFactory"/>
     </analyzer>
     <analyzer type="query">
       <tokenizer class="solr.StandardTokenizerFactory"/>

       <filter class="solr.LowerCaseFilterFactory"/>
     </analyzer>
   </fieldType>





--
View this message in context: http://lucene.472066.n3.nabble.com/need-help-with-exact-match-search-tp4014832.html Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to