索引分析器vs查询分析器在haystack - 弹性搜索? [英] index analyzer vs query analyzer in haystack - elasticsearch?

查看:218
本文介绍了索引分析器vs查询分析器在haystack - 弹性搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

弹性搜索本身似乎支持索引分析器和查询分析器,

,但是haystack的弹性搜索似乎并不区分它们。



我正确吗?



相关问题是,



Elasticsearch的DEFAULT_SETTING似乎有settings.analysis.anaylyzer和index.analysys.anaylyzer。 (例如, http://www.wellfireinteractive.com/blog/custom-haystack -asasticsearch-backend / 有'index')他们有什么区别?

解决方案

使用干草堆,你想要自己设置映射。



我早些时候写过关于haystack的内容: Django Haystack区域的不同值



在设置中,您可以定义分析器一个搜索时间分析器和一个查询时间分析器,它们可以是一个默认分析器(这是默认设置为默认值并在搜索和索引时间应用的)。



定义搜索时间分析器和索引时间分析器通常是很好的做法,即使它们完全相同。



使用雪球文本分析,您可能希望在搜索和索引时应用这一点,但是像自动完成功能一样,您可能不希望(这是干草堆)。您希望索引分析器存储(边缘)ngram,通常您要应用更严格的搜索时间分析,如关键字。



您几乎不想让haystack定义



至于第二部分,请参阅这里: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html



中途说:


请注意,您不必明确指定索引

我也是自己尝试过,因为我从来没有测试过。 p>

Elasticsearch itself seems to support index-analyzer and query-analyzer,
but haystack's elasticsearch doesn't seem to differentiate them.

Am I Correct?

related question is,

Elasticsearch's DEFAULT_SETTING seems to have 'settings.analysis.anaylyzer' and 'index.analysys.anaylyzer'. (eg. http://www.wellfireinteractive.com/blog/custom-haystack-elasticsearch-backend/ has 'index') What's the difference between them?

解决方案

With haystack, you want to set the mappings yourself.

I wrote about haystack as well earlier here: Django Haystack Distinct Value for Field

In the settings, you can define analyzers on a per field basis, they can be a default analyzer (which is what haystack defaults to and get's applied at both search and index time) a search time analyzer and a query time analyzer.

It's usually good practice to define both a search time analyzer and index time analyzer, even if they are the exact same.

Using snowball text analyses, you might want to apply this at both search and index time, but something like an autocomplete feature, you might not want that (which is what haystack does). You want the index analyzer to store (edge)ngrams and usually you want to apply a stricter search time analysis, like keyword.

You almost never want to let haystack define the mapping.

As for the second part, see here: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html

Mid way down it says:

"Note you do not have to explicitly specify index section inside settings section."

I just tried this myself as well, because I had never tested it.

这篇关于索引分析器vs查询分析器在haystack - 弹性搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆