lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Strange issue with String vs. Query
Date Sat, 27 Mar 2010 01:21:10 GMT

: quick. I'm using Lucene version 2.4.1
: and QueryParser. The search results between the two queries are now in 
: different orders while the number of results are the same. I have one 

: Old Way
: QueryParser parser = new QueryParser("words", analyzer);
: Query q = parser.parse("+words:(one two) +year:[1950 2010]");
: New Way
: q.add(new RangeQuery(new Term("year", 1950), new Term("year", 2010), true), Occur.MUST);

You are using RangeQuery which takes into account the idf of each term ... 
QueryParser (in 2.4) uses ConstantScoreRangeQuery instead.

I would change your new code to use ConstantScoreRangeQuery and go with 
that (the order will be determed based on the score of the "words" not the 
dates -- that's typically what people want)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message