On 22 Nov 2005, at 11:29, Gus Kormeier wrote:
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.
That is incorrect. Adding fields with the same name _appends_ them,
it does not overwrite them. In your example, it would be (ignoring
the Analyzer part of the equation for the moment, as if you had just
added one sequence field like this:
doc.add(Field.Text("sequence", "1 2 3"));
Do note that I just made an enhancement to Lucene that allows custom
analyzers to affect the gaps between multiple fields of the same
name. In your example, a PhraseQuery of "1 2" would match the
document, but in one of my projects that is undesirable.
To answer the previous question, yes, the fields are added in order,
so you could rely on the indexes to line up.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]