Solr在搜索数字时不返回答案
我正在使用Solr在搜索数字时不返回答案,solr,Solr,我正在使用 http://...:8983/solr/vault/select?q="design test"&fl=PackageName 我得到3个结果: 设计测试 2013年设计测试 作业设计测试 现在,当我使用q=“测试作业”进行查询时 ->我只得到“工作设计测试” 但当我使用q=2013进行查询时 http://...:8983/solr/vault/select?q=2013&fl=PackageName 我没有结果。 当我用数字查询时,为什么它不返回答案 在
http://...:8983/solr/vault/select?q="design test"&fl=PackageName
我得到3个结果:
- 设计测试
- 2013年设计测试
- 作业设计测试
->我只得到“工作设计测试” 但当我使用q=2013进行查询时
http://...:8983/solr/vault/select?q=2013&fl=PackageName
我没有结果。
当我用数字查询时,为什么它不返回答案
在模式xml中
<field name="PackageName" type="text_en" indexed="true" stored="true" required="true"/>
编辑
这里是文本。
它与初始配置(schema.xml)一起提供
默认的
文本类型不会删除数字。您可以在管理面板的分析选项卡中进行检查:在组合框中选择text\u en
,并在索引和查询字段中键入2013
,然后查看如何分析它们
查询应如下所示:http://...:8983/solr/vault/select?q=PackageName:2013
<代码>http://...:8983/solr/vault/select?q=2013&fl=PackageName
表示您正在默认字段(默认字段是什么?)中搜索,并且只想在结果中显示PackageName
字段。文本是如何标记/分析的?您能给出您使用的类型的定义吗<代码>文本定义在原始问题中添加了文本定义
<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>