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]

Reply via email to