简体   繁体   English

如何配置Solr(如solrconfig.xml),以便隐含“〜” /模糊查询,而不必将其添加到所有查询的末尾?

[英]How can I configure Solr (like solrconfig.xml) so that the “~”/fuzzy query is implied without be having to add it to the end of all queries?

I am currently using Apache Solr 5.5.1 and I would like to generate fuzzy results without having to add the "~" at the end of the query. 我当前正在使用Apache Solr 5.5.1,并且我想生成模糊结果而不必在查询末尾添加“〜”。 As an example if I run a query against "Fellowships" it does not find any records that contain "fellowship" without the ending "s" but if I run the query against "Fellowships~" it does find these "fellowship" records. 举例来说,如果我对“奖学金”运行查询,它将找不到包含“奖学金”但不以“ s”结尾的任何记录,但是如果我对“奖学金〜”运行查询,它将找到这些“奖学金”记录。 How can I configure Solr (like solrconfig.xml) so that the "~"/fuzzy query is implied without be having to add it to the end of all queries? 如何配置Solr(如solrconfig.xml),以便隐含“〜” / fuzzy查询,而不必将其添加到所有查询的末尾?

You'd probably be better off using a stemmer to actually stem terms to their common format, instead of using fuzzy search to achieve the same. 使用词干分析器将术语实际词干化为通用格式可能会更好,而不是使用模糊搜索来实现相同的目的。

There is no way to make all terms behave fuzzy, as it's part of the query syntax and not an argument by itself. 没有办法使所有术语表现为模糊的,因为它是查询语法的一部分,而不是参数本身。 If you really want to apply it as a fuzzy query, append the ~x in your middleware. 如果你真的想将它应用为模糊查询,追加~x在你的中间件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM