Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
多个字段在solr中具有搜索文本_Solr - Fatal编程技术网

多个字段在solr中具有搜索文本

多个字段在solr中具有搜索文本,solr,Solr,我有以下四个默认字段,基于仅CV、反馈和记录中的选择,或它们的组合或全部: cv_文本 cv_反馈 简历 cv_记录_反馈 所有四个字段都是文本\常规类型,定义为 <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.WhitespaceTokenize

我有以下四个默认字段,基于仅CV、反馈和记录中的选择,或它们的组合或全部: cv_文本 cv_反馈 简历 cv_记录_反馈

所有四个字段都是文本\常规类型,定义为

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
    <!-- in this example, we will only use synonyms at query time
    <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
    -->
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.StandardFilterFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>
<>当我尝试搜索特殊的词如C++或C时,SoR只返回默认搜索字段,即使在其他字段中有C++或C字,也可以返回搜索结果。

这是因为

a您使用的是默认的lucene查询解析器,没有明确提到目标字段,即您的查询只包含术语。在这种情况下,将使用默认字段

b您使用的是edismax查询解析器,而qf参数仅包含该字段

看到你的评论后,我想你是第一个选择。所以我建议你

检查solr日志以查看gui是否发送了正确的查询 在浏览器中重复相同的查询,并添加debug=true。您将看到Solr如何看待查询 使用Solr admin中的架构浏览器,检查不返回结果的字段的内容……可能是空的,即这些字段中没有索引
您的查询字符串是什么样子的?您可以使用qf提供要查询的字段。q:cv_text:C++是查询,我将根据从前端UI中选择的单选按钮选择默认字段。单选按钮是1。记录2。反馈您能详细说明一下@Andrea吗