Hello,

I use a index with a numeric field:

   /doc.add( new Field(...));/
   /doc.add( new Field(...));/
   /doc.add(new NumericField(fieldName,Field.Store.YES,true)/
/ .setIntValue(intFieldValue));/
   /indexWriter.addDocument(doc);/


Then I search with a BooleanQuery with a NumericRangeQuery as subquery:

   /...
   BooleanQuery query = new BooleanQuery();/

   ...
   /query.add(...)/
   /query.add(...)/
   /if(duration != -1) {/
   /    query.add(NumericRangeQuery.newIntRange(durationFieldName,/
   /                    Math.max(0, duration - DURATION_RANGE), /
   /                    duration + DURATION_RANGE, true, true),/
   /                    BooleanClause.Occur.SHOULD);/
   }
   ...

With that query I cannot find the document I search for - even if I tested the statement with the exact duration it is not to find:

   /NumericRangeQuery.newIntRange(//durationFieldName//,/
   /                    duration, /
   /                     duration, true, true)/


But if I look with luke in the index the document is indexed and inside the index and if i search the document with duration = -1 the doc will be found.

So here are the questions:

1. Is there a way to see if the field is indexed correct as a numeric Field? Luke shows: ITS---f0-- . So the field is Indexed, Tokenized, Stored, Omit TF, Omit Norms but I don't see if the Field is a NumericField.

2. What may be the reason, that the NumericRangeQuery query does not work?

I use lucene v. 3.0.2.

Thanks in advance!
Thomas

Reply via email to