lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: Indexing an IntField but getting SotredField from found Document
Date Thu, 19 Feb 2015 15:16:04 GMT
I think if you follow the Field.fieldType().numericType() chain you'll
end up with INT or DOUBLE or whatever.

But if you know you stored it as an IntField then surely you already
know it's an integer?  Unless you sometimes store different things in
the one field.  I wouldn't do that.


--
Ian.


On Thu, Feb 19, 2015 at 12:22 PM, Clemens Wyss DEV <clemensdev@mysign.ch> wrote:
> When I index a Document with an IntField and then find that very Document the former
IntField is returned as StoredField. How do I determine the "original" fieldtype (IntField,
LongField, DoubleField ...)?
>
> Must I ?
> Number number = Field.numericValue();
> if( number != null )
> {
>   if( number instanceof Integer)
>   {
>     ...
>   }
>   else if( number instanceof Double)
>   {
>     ...
>   }
>   ....
> }

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