Frederico Azeiteiro wrote:
But it is unusual to use both leading and trailing * operator. Why are
you doing this?
Yes I know, but I have a few queries that need this. I'll try the
"ReversedWildcardFilterFactory".
ReverseWildcardFilter will help leading wildcard, but will not help
trying to use a query with BOTH leading and trailing wildcard. it'll
still be slow. Solr/lucene isn't good at that; I didn't even know Solr
would do it at all in fact.
If you really needed to do that, the way to play to solr/lucene's way of
doing things, would be to have a field where you actually index each
_character_ as a seperate token. Then leading and trailing wildcard
search is basically reduced to a "phrase search", but where the words
are actually characters. But then you're going to get an index where
pretty much every token belongs to every document, which Solr isn't that
great at either, but then you can apply "commongram" stuff on top to
help that out a lot too. Not quite sure what the end result will be,
I've never tried it. I'd only use that weird special "char as token"
field for queries that actually required leading and trailing wildcards.
Figuring out how to set up your analyzers, and what (if anything) you're
going to have to do client-app-side to transform the user's query into
something that'll end up searching like a "phrase search where each
'word' is a character.... is left as an exersize for the reader. :)
Jonathan