lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gus Kormeier <g...@altrec.com>
Subject RE: Custom sort/basic question
Date Tue, 22 Nov 2005 16:29:46 GMT
Hey John,
	My understanding is that if you add a field with the same name as a
previous field added, you will be overwriting the value stored in the
document.

So if you add:
doc.add(Field.Text("sequence", "1"));
doc.add(Field.Text("sequence", "2"));
doc.add(Field.Text("sequence", "3"));

Afterwards, the field sequence would hold a value of 3.

I'm guessing that by now you have already tested that.
-Gus


-----Original Message-----
From: John Powers [mailto:jpowers@configureone.com]
Sent: Monday, November 21, 2005 3:01 PM
To: java-user@lucene.apache.org
Subject: Custom sort/basic question


If I add keywords to a document at the same time, will they stay in that
order?


Create New doc A
doc.add(Field.Text("category", "toys"));
doc.add(Field.Text("sequence", "235"));

doc.add(Field.Text("category", "bears"));
doc.add(Field.Text("sequence", "63"));

doc.add(Field.Text("category", "trucks"));
doc.add(Field.Text("sequence", "56"));



Create New doc B
doc.add(Field.Text("category", "computers"));
doc.add(Field.Text("sequence", "7"));

doc.add(Field.Text("category", "bears"));
doc.add(Field.Text("sequence", "12"));

doc.add(Field.Text("category", "trucks"));
doc.add(Field.Text("sequence", "772"));

I want to sort on the right sequence number, so I need to find the right
category.   If I iterator through doc.getFields( category) and find the
category I want is #2, then can I get sequence #2 and know its the right
one?

Or does everything get jumbled up in the indexing process?


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