0

我正在查询使用

http://...:8983/solr/vault/select?q="design test"&fl=PackageName

我得到 3 个结果:

  • 设计测试
  • 2013年设计测试
  • 工作设计测试

现在,当我使用 q="test for jobs" 进行查询时
-> 我只得到“设计测试作业”

但是当我使用 q = 2013 查询时

http://...:8983/solr/vault/select?q=2013&fl=PackageName

我没有结果。为什么我用数字查询时它不返回答案?

在架构 xml 中

 <field name="PackageName" type="text_en" indexed="true" stored="true" required="true"/>

编辑 这里是 text_en。它带有初始配置(schema.xml)

<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <!-- in this example, we will only use synonyms at query time
    <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
    -->
    <!-- Case insensitive stop word removal.
      add enablePositionIncrements=true in both the index and query
      analyzers to leave a 'gap' for more accurate phrase queries.
    -->
    <filter class="solr.StopFilterFactory"
            ignoreCase="true"
            words="lang/stopwords_en.txt"
            enablePositionIncrements="true"
            />
    <filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
    <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
    <filter class="solr.EnglishMinimalStemFilterFactory"/>
-->
    <filter class="solr.PorterStemFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
    <filter class="solr.StopFilterFactory"
            ignoreCase="true"
            words="lang/stopwords_en.txt"
            enablePositionIncrements="true"
            />
    <filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
    <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<!-- Optionally you may want to use this less aggressive stemmer instead of PorterStemFilterFactory:
    <filter class="solr.EnglishMinimalStemFilterFactory"/>
-->
    <filter class="solr.PorterStemFilterFactory"/>
  </analyzer>
</fieldType>
4

1 回答 1

0

默认text_en类型不删除数字。您可以在管理面板的分析选项卡中检查它:text_en在组合框中选择并输入2013索引和查询字段,然后查看它们是如何分析的。

查询应如下所示:http://...:8983/solr/vault/select?q=PackageName:2013. http://...:8983/solr/vault/select?q=2013&fl=PackageName意味着,您正在默认字段中搜索(您的默认字段是什么?)并且希望仅PackageName在结果中显示字段。

于 2013-09-11T09:10:51.233 回答