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: u...@thetaphi.de > -----Original Message----- > From: Sven Teichmann [mailto:s.teichm...@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.teichm...@s4ip.de > > Local Court of Munich HRB 125803, UstId DE201282006 General Manager: > Alexander Wagner > ______________________________________________________ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org