0

I've set up SOLR, and added a document to the example 'collection1'.

<doc>
    <str name="id">3007WFP</str>
    <str name="name">Fishing</str>
    <str name="type">Ladies</str>
</doc>

I can query it ok in the interface using

name:*fishing*

but I would like to get stemming to work, so that I can e.g. type fish and get this document due to the word fishing being stemmed. I'd also like to be able to find Ladies when Lady is searched for.

However I have tried the query

name:fish

and I get no results. I didn't add the wildcard as I know that will match, and only want to test the stemming function.

I've changed the schema type of both the name and type fields to text_en which I believe includes stemming - restarted SOLR, and reindexed (clicked optimise).

Is there something I'm missing or doing wrong, is the query syntax different when you want to use stemming?

Another strange issue is after the change from text_general to text_en a search for

name:Fishing

produces no results, even though it should be an exact match..

4

2 回答 2

2

单击优化不会重新索引文档。它只会合并现有索引中的各个段,这意味着您的索引仍然是旧的。因此,一旦您重新发布即重新索引您的文档,name:fish应该匹配。

顺便说一句,您可以查看分析器在做什么http://localhost:8983/solr/#/collection1/analysis。您可以选择 fieldType 并查看索引时会发生什么。例如,使用此工具,您可以看到对于text_en类型,

fishing -> fish
ladies -> ladi

所以搜索type:lady不会匹配这个文档。如果您还在“字段值(查询)”中指定查询,它将突出显示匹配项(如果有)。

于 2013-02-20T15:42:29.423 回答
0

您必须删除文档并重新添加它们,以便新的fieldType更改生效。

有关如何stemming工作以及可用的不同类型的词干提取的详细信息,您可以查看此处

在您的情况下,语言是英语,因此您可以使用PorterStemFilterFactory.

于 2013-02-20T15:54:15.617 回答