Hi Dave,
generally giving terms in a dictionary, it's much more efficient to run
prefix queries than "contain" queries.
Talking about using docValues, if I remember well when they are loaded in
memory they are skipList, so you can use two operators on them :

- next() that simply gives you ht next field value for the field doc values
loaded
- advance ( ByteRef term) which jump to the term of the greatest term if
the one searched is missing.

Using the facet prefix we can jump to the point we want and basically
iterate the values that are matching.

To verify the contains, it is simply used on each term in the docValues,
term by term, using the StringUtil.contains() .
How many different unique terms do you have in the index for that field ?

So the difference in performance could make sense ( we are basically moving
to logarithmic to linear to simplify) .

I read the name of the field as "facet.field=autocomplete", it's legit to
ask you if you are using faceting to obtain infix auto completion ?
In the case, can you help us, better identifying the problem and maybe
provide you with a better solution ?

Cheers



2015-07-21 9:16 GMT+01:00 Lo Dave <dav...@hotmail.com>:

> 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

Reply via email to