lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Lucene Wildcard for zero or one character
Date Tue, 25 Mar 2014 15:34:53 GMT
The default WildcardQuery only supports:

'*' (star) is the wildcard in WildcardQuery for zero or more chars. 
'?' is exactly one char

Zero or exatly one char can only be done with a RegexpQuery: https://lucene.apache.org/core/4_7_0/core/org/apache/lucene/search/RegexpQuery.html
Here is the syntax: https://lucene.apache.org/core/4_7_0/core/org/apache/lucene/util/automaton/RegExp.html


Query parser supports regex queries since 4.0 with "/" as delimiter: http://lucene.apache.org/core/4_7_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Sven Teichmann [mailto:s.teichmann@s4ip.de]
> Sent: Tuesday, March 25, 2014 2:57 PM
> To: java-user@lucene.apache.org
> Subject: Lucene Wildcard for zero or one character
> 
> Hello,
> 
> does Lucene provide a zero or one character wildcard (like ? in Perl RegEx)?
> 
> Example of what I mean:
> "house%" finds "house" and "houses"
> 
> As far as I know in Lucene the ? wildcard is for exactly one character, but I
> need a zero or one character wildcard.
> 
> Best regards,
> 
> --
> Sven Teichmann
> ______________________________________________________
> 
> Software for Intellectual Property GmbH
> Gewerbering 14a
> 83607 Holzkirchen (Germany)
> Phone:  +49 (0)8024 46699-00
> Fax:    +49 (0)8024 46699-02
> E-Mail: s.teichmann@s4ip.de
> 
> Local Court of Munich HRB 125803, UstId DE201282006 General Manager:
> Alexander Wagner
> ______________________________________________________
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
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