It doesn't matter at all if you try to e.g. optimize a WildcardQuery
like foo* into a PrefixQuery, because Lucene turns all of these
queries into an AutomatonQuery anyway, which efficiently intersects a
term automaton with the terms dictionary.

Mike McCandless

http://blog.mikemccandless.com


On Sun, Oct 16, 2016 at 8:54 PM, Trejkaz <trej...@trypticon.org> wrote:
> On Sat, Oct 15, 2016 at 1:21 AM, Rajnish Kamboj <rajnis...@gmail.com> wrote:
>> Hi
>>
>> Performance of Prefix, Wildcard and Regex queries?
>> Does Lucene internally optimizes this (using rewrite or something else) or
>> I have to manually create specific queries depending on input pattern.
>>
>> Example
>> if input is 78* create Prefix query
>> if input is 87?98* create Wildcard query
>> if input is 87[7-5]* create Regex query.
>
> I think QueryParser already takes care of converting to PrefixQuery
> when possible.
>
> Regexes aren't really possible, though. Consider this:
>
>     abc*     (wildcard query, matching abc followed by anything)
>
> Versus this:
>
>     abc*      (regex query, matching ab followed by 0 or more c)
>
> I think for that, you're going to want additional syntax in your query parser.
>
> TX
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to