Solr管理界面分析结果与solr搜索结果不匹配

时间:2011-06-29 01:10:07

标签: lucene solr full-text-search

Solr中有6个索引文档,文本字段为“name_texts”。当Admin UI为“blue-cat”且搜索词为“blueCat”时,Admin UI会突出显示字段值。但搜索查询返回0结果。为什么会这样?

http://localhost:8982/solr/select?q=name_texts:blueCat

<response>
  <lst name= "responseHeader">
    <int name= "status">0</int>
    <int name= "QTime">2</int>
    <lst name= "params">
      <str name= "q">name_texts:blueCat</str>
    </lst>
  </lst>
  <result name= "response" numFound= "0" start= "0" />
</response>

http://localhost:8982/solr/select?q= *:*

<response>                                                                                                                                                                                                                             
  <lst name= "responseHeader">                                                                                                                                                                                                         
    <int name= "status">0</int>                                                                                                                                                                                                        
    <int name= "QTime">2</int>                                                                                                                                                                                                         
    <lst name= "params">                                                                                                                                                                                                               
      <str name= "q">*:*</str>                                                                                                                                                                                                         
    </lst>                                                                                                                                                                                                                             
  </lst>                                                                                                                                                                                                                               
  <result name= "response" numFound= "6" start= "0">                                                                                                                                                                                   
    <doc>                                                                                                                                                                                                                              
      <str name= "id">Track 106216</str>                                                                                                                                                                                               
      <arr name= "name_texts">                                                                                                                                                                                                         
        <str>blue-cat</str>                                                                                                                                                                                                            
      </arr>                                                                                                                                                                                                                           
    </doc>                                                                                                                                                                                                                             
    <doc>                                                                                                                                                                                                                              
      <str name= "id">Track 106217</str>                                                                                                                                                                                               
      <arr name= "name_texts">                                                                                                                                                                                                         
        <str>Blue_cat</str>                                                                                                                                                                                                            
      </arr>                                                                                                                                                                                                                           
    </doc>                                                                                                                                                                                                                             
    <doc>                                                                                                                                                                                                                              
      <str name= "id">Track 106218</str>                                                                                                                                                                                               
      <arr name= "name_texts">                                                                                                                                                                                                         
        <str>blueCat</str>                                                                                                                                                                                                             
      </arr>                                                                                                                                                                                                                           
    </doc>                                                                                                                                                                                                                             
    <doc>                                                                                                                                                                                                                              
      <str name= "id">Track 106219</str>                                                                                                                                                                                               
      <arr name= "name_texts">                                                                                                                                                                                                         
        <str>blue_cat1</str>                                                                                                                                                                                                           
      </arr>                                                                                                                                                                                                                           
    </doc>                                                                                                                                                                                                                             
    <doc>                                                                                                                                                                                                                              
      <str name= "id">Track 106220</str>                                                                                                                                                                                               
      <arr name= "name_texts">                                                                                                                                                                                                         
        <str>BlueCat4</str>                                                                                                                                                                                                            
      </arr>                                                                                                                                                                                                                           
    </doc>                                                                                                                                                                                                                             
    <doc>                                                                                                                                                                                                                              
      <str name= "id">Track 106221</str>                                                                                                                                                                                               
      <arr name= "name_texts">                                                                                                                                                                                                         
        <str>blue-Cat45</str>                                                                                                                                                                                                          
      </arr>                                                                                                                                                                                                                           
    </doc>                                                                                                                                                                                                                             
  </result>                                                                                                                                                                                                                            
</response>    

这是一个schema.xml

<fieldType name="text" class="solr.TextField" omitNorms="false">                                                                                                                                                                       
  <analyzer type="index">                                                                                                                                                                                                              
    <tokenizer class="solr.StandardTokenizerFactory"/>                                                                                                                                                                                 
    <filter class="solr.StandardFilterFactory"/>                                                                                                                                                                                       
    <filter class="solr.WordDelimiterFilterFactory"                                                                                                                                                                                    
            generateWordParts="1"                                                                                                                                                                                                      
            generateNumberParts="1"                                                                                                                                                                                                    
            catenateWords="1"                                                                                                                                                                                                          
            catenateNumbers="1"                                                                                                                                                                                                        
            catenateAll="0"                                                                                                                                                                                                            
            preserveOriginal="1"                                                                                                                                                                                                       
            />                                                                                                                                                                                                                         
    <filter class="solr.LowerCaseFilterFactory"/>                                                                                                                                                                                      
    <filter class="solr.StopFilterFactory" words="stopwords.txt"                                                                                                                                                                       
            ignoreCase="true"/>                                                                                                                                                                                                        
    <filter class="solr.ISOLatin1AccentFilterFactory"/>                                                                                                                                                                                
    <filter class="solr.TrimFilterFactory" />                                                                                                                                                                                          
    <filter class="solr.EdgeNGramFilterFactory"                                                                                                                                                                                        
            minGramSize="2"                                                                                                                                                                                                            
            maxGramSize="25" />                                                                                                                                                                                                        
  </analyzer>                                                                                                                                                                                                                          
  <analyzer type="query">                                                                                                                                                                                                              
    <tokenizer class="solr.StandardTokenizerFactory"/>                                                                                                                                                                                 
    <filter class="solr.StandardFilterFactory"/>                                                                                                                                                                                       
    <filter class="solr.WordDelimiterFilterFactory"                                                                                                                                                                                    
            generateWordParts="1"                                                                                                                                                                                                      
            generateNumberParts="1"                                                                                                                                                                                                    
            catenateWords="0"                                                                                                                                                                                                          
            catenateNumbers="0"                                                                                                                                                                                                        
            catenateAll="0"                                                                                                                                                                                                            
            preserveOriginal="1"                                                                                                                                                                                                       
            />                                                                                                                                                                                                                         
    <filter class="solr.LowerCaseFilterFactory"/>                                                                                                                                                                                      
    <filter class="solr.StopFilterFactory" words="stopwords.txt"                                                                                                                                                                       
            ignoreCase="true"/>                                                                                                                                                                                                        
    <filter class="solr.ISOLatin1AccentFilterFactory"/>                                                                                                                                                                                
    <filter class="solr.TrimFilterFactory" />                                                                                                                                                                                          
  </analyzer>

Admin UI -> Analysis highlights results (screenshot)

1 个答案:

答案 0 :(得分:0)

我认为您的查询对您的数据不好! 我可以请你这样试试:

- field q  --> *:*
- field fq --> nam-texts:*blueCat*

URL
http://localhost:8983/solr/select?q=*%3A*&fq=name_texts%3A*blueCat*&indent=true

给我一​​些反馈! :)