Discussion:
Edismax leading wildcard search
Selvam Raman
2017-12-22 10:57:49 UTC
Permalink
Hi,

Solr version - 6.4

Parser - Edismax

Leading wildcard search is allowed in edismax.

1) how can i disable leading wildcard search
2) why leading wildcard search takes so much of time to give the response.

--
Selvam Raman
"லஞ்சம் ஀விர்஀்஀ு செஞ்சம் சிமிர்஀்஀ு"
Michael Kuhlmann
2017-12-22 11:07:17 UTC
Permalink
Post by Selvam Raman
1) how can i disable leading wildcard search
Do it on the client side. Just don't allow leading asterisks or question
marks in your query term.
Post by Selvam Raman
2) why leading wildcard search takes so much of time to give the response.
Because Lucene can't just look in the index for all terms beginning with
something; it needs to look in all terms instead. Basically, indexed
terms are in alphabetical order, but that doesn't help with leading
wildcards.

There's a ReversedWildcardFilterFactory in Solr to address this issue.

-Michael
Kudrettin Güleryüz
2018-12-07 14:52:00 UTC
Permalink
Hi,

I am also wondering how to disable leading wildcards in Solr. Can you
please suggest how to disable leading wildcards in Solr? I know in Lucene
it is a flag that's set to false by default.
Post by Michael Kuhlmann
Do it on the client side. Just don't allow leading asterisks or question
marks in your query term.

This does not look trivial to me. A search query can be very complicated.
How do you suggest to detect trailing wildcards from a complicated Lucene
query?

Thank you
Post by Michael Kuhlmann
Post by Selvam Raman
1) how can i disable leading wildcard search
Do it on the client side. Just don't allow leading asterisks or question
marks in your query term.
Post by Selvam Raman
2) why leading wildcard search takes so much of time to give the
response.
Because Lucene can't just look in the index for all terms beginning with
something; it needs to look in all terms instead. Basically, indexed
terms are in alphabetical order, but that doesn't help with leading
wildcards.
There's a ReversedWildcardFilterFactory in Solr to address this issue.
-Michael
Erick Erickson
2018-12-07 15:28:48 UTC
Permalink
Well, the other option is to allow leading wildcards, but use
ReversedWildcardFilterFactory. Admittedly that increases the size of
your index, but apparently your users expect leading wildcards so why
not support them?

Best,
Erick
Post by Kudrettin Güleryüz
Hi,
I am also wondering how to disable leading wildcards in Solr. Can you
please suggest how to disable leading wildcards in Solr? I know in Lucene
it is a flag that's set to false by default.
Post by Michael Kuhlmann
Do it on the client side. Just don't allow leading asterisks or question
marks in your query term.
This does not look trivial to me. A search query can be very complicated.
How do you suggest to detect trailing wildcards from a complicated Lucene
query?
Thank you
Post by Michael Kuhlmann
Post by Selvam Raman
1) how can i disable leading wildcard search
Do it on the client side. Just don't allow leading asterisks or question
marks in your query term.
Post by Selvam Raman
2) why leading wildcard search takes so much of time to give the
response.
Because Lucene can't just look in the index for all terms beginning with
something; it needs to look in all terms instead. Basically, indexed
terms are in alphabetical order, but that doesn't help with leading
wildcards.
There's a ReversedWildcardFilterFactory in Solr to address this issue.
-Michael
Loading...