There is also the following, that some guy named Erik contributed recently:
./contrib/regex/src/java/org/apache/regexp/RegexpTunnel.java ./contrib/regex/src/java/org/apache/lucene/search/regex/SpanRegexQuery.java ./contrib/regex/src/java/org/apache/lucene/search/regex/RegexQuery.java ./contrib/regex/src/java/org/apache/lucene/search/regex/JakartaRegexpCapabilities.java ./contrib/regex/src/java/org/apache/lucene/search/regex/JavaUtilRegexCapabilities.java ./contrib/regex/src/java/org/apache/lucene/search/regex/RegexCapabilities.java ./contrib/regex/src/java/org/apache/lucene/search/regex/RegexTermEnum.java ./contrib/regex/src/java/org/apache/lucene/search/regex/RegexQueryCapable.java As for how to use it, see this: ./contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java ./contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java Otis ----- Original Message ---- From: Erik Hatcher <[EMAIL PROTECTED]> To: java-user@lucene.apache.org Sent: Thursday, May 4, 2006 6:19:36 AM Subject: Re: How to realize Sql LIKE? On May 3, 2006, at 9:39 PM, JustineHMS wrote: > I m new to Lucene, > > Just wondering if there is a way to realize sql 'Like' function in > Lucene as > following: > > Select * from user_table where username like '%abc%' > > I have checked with wildCardQuery, but it can not start with a '%'. > What about RegexQuery? How to use it? WildcardQuery does support leading wildcard characters, but QueryParser is what prohibits it. A custom QueryParser could be created that removes this restriction. However, the potential of a "too many clauses" exception is great with WildcardQuery so you'll want to be careful. Check the list archives for this topic in gory and never ending detail :) Erik --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]