lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Rewig <>
Subject Check Numeric Fields
Date Fri, 11 Mar 2011 13:13:46 GMT

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

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

    BooleanQuery query = new BooleanQuery();/

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

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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message