首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自动补全“智能”

自动补全“智能”
EN

Stack Overflow用户
提问于 2014-02-14 08:05:10
回答 1查看 651关注 0票数 5

我是否应该构建一个自动补全的“智能”,在这个意义上,每个结果都必须在一系列信息后面使用。

例如:

我正在寻找"bologna“,我必须运行一个查询(或者多个,我正在寻找一种方法使它尽可能少),在”名称“,”位置“和”区域“字段中搜索"bologna”。

如果发现,有必要统计“博洛尼亚”中有多少个结构。

这是数据库模式:

代码语言:javascript
复制
index:   
analysis:   
    analyzer:
        custom_search_analyzer:
            type: custom
            tokenizer: standard
            filter   : [standard, snowball, lowercase, asciifolding]
        custom_index_analyzer:
            type: custom
            tokenizer: standard
            filter   : [standard, snowball, lowercase, asciifolding, custom_filter]
    filter:
        custom_filter:
            type: edgeNGram
            side: front
            min_gram: 1
            max_gram: 20

{
 "structure": {
   "properties": {
     "name": {"type": "string", "search_analyzer": "custom_search_analyzer", "index_analyzer": "custom_index_analyzer"},
     "locality": {"type": "string", "search_analyzer": "custom_search_analyzer", "index_analyzer": "custom_index_analyzer"},
     "province": {"type": "string", "search_analyzer": "custom_search_analyzer", "index_analyzer": "custom_index_analyzer"},
     "region": {"type": "string", "search_analyzer": "custom_search_analyzer", "index_analyzer": "custom_index_analyzer"}
   }
 }
}

显然,我可以在服务器端做到这一点,例如用php和一个循环,但答案会非常慢,并受挫于elasticsearch的速度。

在这一点上,我想知道我怎么能做到这一点。

EN

回答 1

Stack Overflow用户

发布于 2015-07-15 21:13:25

我已经成功地使用了this guide,它满足了您提到的多字段需求。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21768298

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档