lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: How to realize Sql LIKE?
Date Thu, 04 May 2006 10:19:36 GMT

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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message