Hello - You should index your terms as n-grams indeed, especially for autocompletion. I do not understand why anyone would ever use facet.prefix or facet.contains for any use other than a development tool. It won't perform on any index larger than small.
Jan Høydahl has put up a thorough example for any Solr-user can understand years ago, it'll help you make a decent autocomplete and improve understanding of Lucene and Solr: http://www.cominvent.com/2012/01/25/super-flexible-autocomplete-with-solr/ -----Original message----- > From:Lo Dave <dav...@hotmail.com> > Sent: Thursday 23rd July 2015 3:18 > To: solr-user@lucene.apache.org > Subject: RE: Performance of facet contain search in 5.2.1 > > Yes. I am going to provide autocomplete with facet count as rank.i.e. when > yours input "owe a duty", the system will suggest "xxx owe a duty yyy" with > highest count. > Thanks. > Dave > > Date: Wed, 22 Jul 2015 14:35:40 +0100 > > Subject: Re: Performance of facet contain search in 5.2.1 > > From: benedetti.ale...@gmail.com > > To: solr-user@lucene.apache.org > > > > I think as usually Erick says, this is a X-Y problem. > > I think the user was trying to solve the infix autocomplete problem with > > faceting. > > > > We should get from him the initial problem to try to suggest a better > > solution. > > > > Cheers > > > > 2015-07-22 14:01 GMT+01:00 Markus Jelsma <markus.jel...@openindex.io>: > > > > > Hello - why not index the facet field as n-grams? It blows up the index > > > but is very fast! > > > Markus > > > > > > -----Original message----- > > > > From:Erick Erickson <erickerick...@gmail.com> > > > > Sent: Tuesday 21st July 2015 21:36 > > > > To: solr-user@lucene.apache.org > > > > Subject: Re: Performance of facet contain search in 5.2.1 > > > > > > > > "contains" has to basically examine each and every term to see if it > > > > matches. Say my > > > > facet.contains=bbb. A matching term could be > > > > aaabbbxyz > > > > or > > > > zzzbbbxyz > > > > > > > > So there's no way to _know_ when you've found them all without > > > > examining every last > > > > one. So I'd try to redefine the problem to not require that. If it's > > > > absolutely required, > > > > you can do some interesting things but it's going to inflate your index. > > > > > > > > For instance, "rotate" words (assuming word boundaries here). So, for > > > > instance, you have > > > > a text field with "my dog has fleas". Index things like > > > > my dog has fleas|my dog has fleas > > > > dog has fleas my|my dog has fleas > > > > has fleas my dog|my dog has fleas > > > > fleas my dog has|my dog has fleas > > > > > > > > Literally with the pipe followed by the original text. Now all your > > > > contains clauses are > > > > simple prefix facets, and you can have the UI split the token on the > > > > pipe and display the > > > > original. > > > > > > > > Best, > > > > Erick > > > > > > > > On Tue, Jul 21, 2015 at 1:16 AM, Lo Dave <dav...@hotmail.com> wrote: > > > > > I found that facet contain search take much longer time than facet > > > prefix search. Do anyone have idea how to make contain search faster? > > > > > org.apache.solr.core.SolrCore; [concordance] webapp=/solr path=/select > > > params={q=sentence:"duty+of+care"&facet.field=autocomplete&indent=true&facet.prefix=duty+of+care&rows=1&wt=json&facet=true&_=1437462916852} > > > hits=1856 status=0 QTime=5 org.apache.solr.core.SolrCore; [concordance] > > > webapp=/solr path=/select > > > params={q=sentence:"duty+of+care"&facet.field=autocomplete&indent=true&facet.contains=duty+of+care&rows=1&wt=json&facet=true&facet.contains.ignoreCase=true} > > > hits=1856 status=0 QTime=10951 > > > > > As show above, prefix search take 5 but contain search take 10951 > > > > > Thanks. > > > > > > > > > > > > > > > > -- > > -------------------------- > > > > Benedetti Alessandro > > Visiting card - http://about.me/alessandro_benedetti > > Blog - http://alexbenedetti.blogspot.co.uk > > > > "Tyger, tyger burning bright > > In the forests of the night, > > What immortal hand or eye > > Could frame thy fearful symmetry?" > > > > William Blake - Songs of Experience -1794 England >