lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eduardo Pierdant" <eduar...@occ.com.mx>
Subject Question: searching on a NumericField, with sort and filter
Date Tue, 06 Jul 2010 17:49:00 GMT

Hi all.


I've been dealing  with a small problem when searching and trying to sort
and filter on a NumericField using Lucene 2.9.2; the result never comes back
as expected. Here are some snippets of my code, so you might take a look and
reference me  or help me out to solve this problem.


At document creation, I add the field like this:
 	doc.add(new NumericField("PuntosJobSense", Field.Store.YES,
false).setIntValue(Integer.parseInt(puntosJS)));

When searching, I use a sort field and a Filter:

	SortField sf = new SortField("PuntosPatrocinadas", SortField.INT,
true);
	Sort sortOrder = new Sort(sf);
	Filter nf = NumericRangeFilter.newIntRange("PuntosPatrocinadas", 0,
Integer.MAX_VALUE, true, true);
	hits = searcher.search(query, nf, MAX_DOC_SEARCH,
sortOrder).scoreDocs;

the only "query" parameter that I'm passing so far is "date modified" that
uses the date the document was added to the index. If I don't use this
search and simply search without filter nor sorting, everything is ok.

Hope someone can help me out.
Eduardo



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