lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <>
Subject Re: Customizing Regexp syntax in Lucene
Date Mon, 06 Apr 2015 01:09:46 GMT
On Sun, Apr 5, 2015 at 5:08 PM, code fx9 <> wrote:
> Hi,
> We are using Lucene indirectly via ElasticSearch. We would like to use RE2
> syntax for running regex queries against Lucene. We are already using RE2
> syntax for other parts of our system, so not ability to use the same syntax
> is a deal-breaker for us.
> Recently Google has released a pure Java implementation of this library on
> GitHub. Will it be possible to actually use RE2/J library to run regex
> queries in Lucene? I understand that it might require customizing Lucene
> source code. Can you give me any idea how complex and time consuming such
> endeavor might be.
> RE2 Syntax:
> RE2/J :
> Thanks.

The only place in lucene that "knows" about syntax is RegexpQuery. It
only has logic for parsing that syntax into a state machine (Automaton
class), otherwise AutomatonQuery takes care of the execution.

Maybe you could create an Re2Query class that works in a similar way:
e.g. uses RE2/J library to parse the syntax into its state machine
representation and translates that to Automaton representation used by

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message