lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
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)

-Hoss


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