You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Dmitry Goldenberg <dm...@weblayers.com> on 2006/01/04 22:41:50 UTC
Lucene and Regex - ?
Hi,
Can someone provide a quick summary of the Regex capabilities in Lucene? I see there's a RegexQuery and a SpanRegexQuery - what are they intended for and how do I use them?
Thanks,
- Dmitry
Re: Lucene and Regex - ?
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Dmitry,
RegexQuery is similar in behavior to Lucene's built-in WildcardQuery,
except rather than accepting only ? and * as wildcard characters it
leverages the full expression capability of whatever underlying
regular expression engine is selected.
SpanRegexQuery is a "span" version of RegexQuery, allowing for
queries like "j.v. l.*" that could match "java lucene" and any other
two sequential terms that match those patterns. There currently is
no QueryParser support for this kind of syntax. Perhaps in the
future the neutral part of (Span)RegexQuery could be moved into the
core (it currently lives in contrib/regex and has dependencies on
Jakarta Regexp, and likely Jakarta ORO also) to facilitate future
QueryParser support. For now you'll need to construct the queries
via the API, build a custom QueryParser extension, or a completely
custom QueryParser.
The test cases are generally the best place to look for usage examples.
I am working on polishing the documentation and tidying some loose
ends with contrib/regex, but patches/suggestions always welcome.
Erik
On Jan 4, 2006, at 4:41 PM, Dmitry Goldenberg wrote:
> Hi,
>
> Can someone provide a quick summary of the Regex capabilities in
> Lucene? I see there's a RegexQuery and a SpanRegexQuery - what are
> they intended for and how do I use them?
>
> Thanks,
> - Dmitry
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org