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

发布于 2024-11-17 18:11:48 字数 20727 浏览 1 评论 0原文

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

http://localhost:8982/so​​lr/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/so​​lr/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>

管理界面 ->分析重点结果(截图)

There are 6 indexed document in Solr with the text field "name_texts". The Admin UI highlights field value when it is "blue-cat" and the search term is "blueCat". But the search query returns 0 results. Why that happens ?

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>    

This is a 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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风渺 2024-11-24 18:11:48

我认为您的查询对于您的数据来说不好!
我可以请您尝试一下:

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

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

给我一些反馈! :)

I think that your query is not good regarding to your datas !
May I ask you to give a try like this :

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

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

Give me some feedback! :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文