lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: :how to add int fileds to lucene:
Date Mon, 12 Dec 2005 16:05:21 GMT

On Dec 12, 2005, at 8:10 AM, Ravi wrote:
> I am trying to add some fields to lucene and I heard that adding  
> int values
> are going to give much faster retrieval than adding to String  
> values. So I
> want to add int values to document . But
>
>
>
> document.add(Field.Text("Candidate", objResultSet.getString 
> ("ROW_ID")));
>
> document.add(Field.Keyword("lastmodified",
> objResultSet.getDate("MODIFIED_ON")));
>
> document.add(Field.Text("days",days) );
>
> document.add(Field.Text("contents", objReader));
>
>
>
>
>
> Days are int but it is giving error . Please suggest me with the  
> steps to
> add and search those integer fields
>

All stored field data in a Lucene index are Strings.  The performance  
difference you may be referring to is with sorting results, not in  
retrieval.

You will want to simply convert your int "days" into a String  
(Integer.toString(days) will do the trick.  Careful with your  
analyzer if you really do want days to be searchable/sortable.  Using  
Field.Keyword() is probably more appropriate.

	Erik


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