Solr 索引,搜索词干

标签 solr

我有一个问题,我有一组员工记录的索引。 全文索引是根据人物的姓名和职位。

我可以毫无问题地搜索像“john”这样的名字,以及像“anthon”这样的名字的一部分并且有效。

但是,某些名称无法正确搜索,例如“anthony”不会返回任何结果,但“anth”会返回所有 anthony 的结果。就像明智地搜索“carly”什么也没有返回,但“car”却返回。

最佳答案

正如 Maurico 评论的那样,不建议将词干提取用于人名。
至少对于人名,词干提取会导致很多意想不到的结果。

此外,检查您的 schema.xml 和应用的字段分析会很有趣。

如果您在索引和查询时使用不同的分析,则可能会出现此问题。

来自 http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#Analyzers

Analyzers are components that pre-process input text at index time and/or at search time. It's important to use the same or similar analyzers that process text in a compatible manner at index and query time. For example, if an indexing analyzer lowercases words, then the query analyzer should do the same to enable finding the indexed words.

从您提到的示例来看,您似乎在索引时在字段上使用了 Stemmer,但在查询时分析时似乎不存在。

关于Solr 索引,搜索词干,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9405785/

相关文章:

tomcat - 使用 Solr 时在 Tomcat 中“未创建核心”

mysql - 将网站的所有读取查询从 mysql 移至 solr

ruby-on-rails - Solr、Sunspot、SQlite 和 Rails

solr 标记和排除范围方面的过滤器

ruby-on-rails - 用 Solr 全文搜索不规则的说唱歌手名字

带破折号的 Solr 查询

solr - 将 Solr 重复值删除到多值字段中

Solr:从 solr 索引中检索字段名称?

c# - 如何让 suggester 组件在 SolrNet 中工作?

java - 使用 solrj 凭证连接到 solr 服务器