lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Hermann <herm...@informatik.uni-freiburg.de>
Subject Re: Search results include results with excluded terms
Date Mon, 16 Aug 2010 18:48:49 GMT
Am Montag, 16. August 2010, 18:35:36 schrieb Steven A Rowe:

Hi,

> I wrote:
> > QueryParser has a static method setLowercaseExpandedTerms() that you can
> > call to turn on automatic pre-expansion query term downcasing:
> > 
> > <http://lucene.apache.org/java/3_0_2/api/all/org/apache/lucene/queryParse
> > r/QueryParser.html#setLowercaseExpandedTerms%28boolean%29>

> Oops, setLowercaseExpandedTerms() is an instance method, not static.

defaults to true.

If i change my code:

QueryParser qp = new QueryParser(Version.LUCENE_30, "contents", 
AnalyzerHelper.getWikipediaAnalyzer("de"));
qp.setLowercaseExpandedTerms(false); <-- HERE
		
String queryStr = "avl tree";
Query q = qp.parse(queryStr);
String noFilesQueryStr = Metadata.TITLE + ":Datei*";
Query q2 = qp.parse(noFilesQueryStr);
		
BooleanQuery finalQuery = new BooleanQuery();
finalQuery.add(q, Occur.MUST);
finalQuery.add(q2, Occur.MUST_NOT);

it works as expected.

Thanks a lot for the hint!

I think i'll recreate my index with a LowerCaseFilter, that should fix it, 
shouldn't it?

regards
Christoph Hermann

-- 
Christoph Hermann
Institut für Informatik
Tel: +49 761-203-8171 Fax: +49 761-203-8162
e-mail: hermann@informatik.uni-freiburg.de

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