On 11/20/2017 12:50 PM, Sundeep T wrote:
> I initially asked this question regarding leading wildcards. This was a
> typo, and what I meant was trailing wild card queries were slow. So queries
> like text:'hello*" are slow. We were expecting since the string field is
> already indexed, the searches should be fast, but that seems to be not the
> case

The following is my understanding of wildcard queries:

Let's say that the wildcard "hello*" matches one million terms on the
text field you're searching.  I have no idea what the actual number
would be ... one million is arbitrary.

Behind the scenes, that query object will quite literally have one
million different terms in it, and ALL of those terms will be checked
against the index to obtain the list of matching documents.  Even if
each check is pretty fast, doing a million of them to satisfy the query
is going to take some time.  Also, it's going to take some time to
gather the one million matching terms in the first place.  The term
gathering step is particularly slow with leading wildcards, but even
trailing wildcards can result in slow queries.

Wildcards that only match a few terms might be quick, but predicting the
number of matching terms BEFORE the query is executed is difficult.

Thanks,
Shawn

Reply via email to