Solr TermsComponent: Usage of wildcards

我们两清 提交于 2020-01-16 04:44:07

问题


I'm using Solr 1.4.1 and I'm willing to use TermsComponent for AutoComplete. The problem is, I can't get it to match strings with spaces in them. So to say,

terms.fl=name&terms.lower=david&terms.prefix=david&terms.lower.incl=false&indent=true&wt=json

matches all strings starting with "david" but if I change it to:

terms.fl=name&terms.lower=david%20&terms.prefix=david%20&terms.lower.incl=false&indent=true&wt=json

it doesn't match all strings starting with "david ". Is it meant to be that way? If so, are n-grams the way to go? And does anybody know if TermsComponent is implementing Tries or DAWGs or Raddix trees and if it's efficient?

Cheers,
Parsa


回答1:


AFAIK TermsComponent provides raw (i.e. literal) access to the fields' terms, so if there isn't any term with space (normally there isn't, the whitespace tokenizer takes care of that) it won't match anything. TermsComponent doesn't implement tries or anything, it just enumerates terms in the field index.

IMHO ngrams are a more flexible solution for autocomplete.

The next release of Solr will have a specific component to implement autosuggest (you could use it now if you use nightly builds)



来源:https://stackoverflow.com/questions/4176747/solr-termscomponent-usage-of-wildcards

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!