自动补全

1. 数据库中用like的方式
2. 在一个检索系统上也可以通过查询前缀来facet结果,例如在solr中,可以直接URL上用select?fl=id,name&rows=0&q=*:*&facet=true&facet.field={$title}&facet.mincount=1&facet.prefix={$input} 方式进行查询,其中{$input} 是你需要自动提示的前缀,{$title}是对某个字段进行提示
3. 对性能要求高,可以用solr的suggest component,其中用的就是lucene-suggest的Lookup实现,其中有好几种实现,都是要从solr的索引数据中遍历词表构建相应数据结构,配置可以到http://www.solr.cc/blog/?p=1025看下

posted @ 2018-06-29 15:24  音为  阅读(115)  评论(0编辑  收藏  举报