我正在使用
查询http://...:8983/solr/vault/select?q="design test"&fl=PackageName
我得到3个结果:
现在当我使用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>
答案 0 :(得分:0)
默认text_en
类型不会删除数字。您可以在管理面板的“分析”选项卡中进行检查:在组合框中选择text_en
,然后在索引和查询字段中键入2013
,并查看它们的分析方式。
查询应如下所示:http://...:8983/solr/vault/select?q=PackageName:2013
。 http://...:8983/solr/vault/select?q=2013&fl=PackageName
表示您要在默认字段中搜索(默认字段是什么?),并希望在结果中仅显示PackageName
字段。