lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morus Walter <morus.wal...@tanto.de>
Subject Re: Storing numbers
Date Fri, 05 Mar 2004 11:27:26 GMT
lucene@nitwit.de writes:
> Hi!
> 
> I want to store numbers (id) in my index:
> 
> 	long id = 1069421083284;
> 	doc.add(Field.UnStored("in", String.valueOf(id)));	
> 
> But searching for "id:1069421083284" doesn't return any hits.

If your field is named 'in' you shouldn't search in 'id'. Right?

> 
> Well, did I misunderstand something? UnStored is the number is stored but not 
> index (analyzed), isn't it? Anyway, Field.Text doesn't work either.
> 
Well, indexing and analyzing are different things.
UnStored means, the number is not stored (as the name says) but indexed.
And IIRC it's analyzed before indexing. Shouldn't make a difference for
a single number.

What I'd use in this case is an unstored keyword (given that you really don't
want to have the id returned from lucene, which is the consequence of
not storing).
I'm not sure if there's a method to create such a field, but you can do it
by setting the flags directly.

HTH
	Morus

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message