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 Tue, 13 Dec 2005 13:58:13 GMT
Ravi,

A few great starting points... the code from http:// 
www.lucenebook.com (and it wouldn't hurt my feelings if you picked up  
a copy of the book itself too :), the examples from the many articles  
that have been written on Lucene, and last but not least, the unit  
tests of Lucene itself which is a great place to learn the API.

	Erik


On Dec 12, 2005, at 10:32 PM, Ravi wrote:

> Hi Erik
>
> Thanks for your solution. I want to do exactly what you have  
> mentioned in
> the mail . I would like to search on the fields what I have added  
> to lucene
> .That is search on  days and sort on those days value and moreover  
> how to
> add multiple field querys to lucene . I don't have any idea how to  
> Query on
> multiple fields .ex  searching on the candidate and days where days  
> >5 and
> candidate>10 or days >one month and so on.. Please give me the code  
> or let
> me know where I can find test programs so that I can complete my  
> project.
>
> Waiting for your reply....
>
> Thanks
> Ravi Kumar Jaladanki
> 408-328-6437
>
>
> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> Sent: Monday, December 12, 2005 9:35 PM
> To: java-user@lucene.apache.org
> Subject: Re: :how to add int fileds to lucene:
>
>
> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


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