如何为词干配置 SOLR
How to configure SOLR for stemming
我正在学习 solr 并使用 solr-5.3.0。我想在 solr 中包含常见的词干分析器。我关注了这个Tutorial。但是当我搜索一个术语时对 schema.xml 进行更改后,我没有得到所需的输出。另外,有很多schema.xml
,我不确定要编辑哪一个。
{
"responseHeader": {
"status": 0,
"QTime": 1,
"params": {
"indent": "true",
"q": "HOLIDAY",
"_": "1441115332479",
"wt": "json"
}
},
"response": {
"numFound": 2,
"start": 0,
"docs": [
{
"id": "1234",
"name": [
"A lovely winter holiday"
],
"_version_": 1511117845476409300
},
{
"id": "1235",
"name": [
"A lovely summer holiday"
],
"_version_": 1511118023312801800
}
]
}
}
当我搜索 holidays
时,它没有给出任何结果。我在 schema.xml
.
中添加了这个
<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" tokenizerFactory="solr.StandardTokenizerFactory"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
尝试使用以下字段类型....
<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" tokenizerFactory="solr.StandardTokenizerFactory"/>
</analyzer>
</fieldType>
我正在学习 solr 并使用 solr-5.3.0。我想在 solr 中包含常见的词干分析器。我关注了这个Tutorial。但是当我搜索一个术语时对 schema.xml 进行更改后,我没有得到所需的输出。另外,有很多schema.xml
,我不确定要编辑哪一个。
{
"responseHeader": {
"status": 0,
"QTime": 1,
"params": {
"indent": "true",
"q": "HOLIDAY",
"_": "1441115332479",
"wt": "json"
}
},
"response": {
"numFound": 2,
"start": 0,
"docs": [
{
"id": "1234",
"name": [
"A lovely winter holiday"
],
"_version_": 1511117845476409300
},
{
"id": "1235",
"name": [
"A lovely summer holiday"
],
"_version_": 1511118023312801800
}
]
}
}
当我搜索 holidays
时,它没有给出任何结果。我在 schema.xml
.
<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" tokenizerFactory="solr.StandardTokenizerFactory"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
尝试使用以下字段类型....
<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" tokenizerFactory="solr.StandardTokenizerFactory"/>
</analyzer>
</fieldType>