Solr TermsComponent: Usage of wildcards
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,
ParsaAFAIK 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)
精彩评论