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 On Fri, Dec 7, 2018 at 6:58 AM Kudrettin Güleryüz <kudret...@gmail.com> wrote: > > 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. > > > 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 > > On Fri, Dec 22, 2017 at 6:07 AM Michael Kuhlmann <k...@solr.info> wrote: > > > Am 22.12.2017 um 11:57 schrieb 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. > > > > > 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 > >