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