I ran a little test where I did: doc.add(new Field("name","value")); doc.add(new Field("name","value"));
Then got a list of the field for that doc and sure enough it is in there twice. So it appends whatever value to the field, even if the value already exists. Thanks, Rob -----Original Message----- From: David Spencer [mailto:[EMAIL PROTECTED] Sent: Thursday, March 20, 2003 8:53 AM To: Lucene Users List Subject: Re: Quick Question On Adding Fields Rob Outar wrote: >What happens if I add the same name/value pair to a Lucene Document? Does >it override it? Does it append it so you have duplicates? > I believe it 'appends' in the sense that if you add 2 fields with the same name then the Document has the union of the content of both fields added, and then you can search on anything in either or both of the field values you added. One use case is if you're indexing html and you want a field for the title, a field for the body, and a easy way for users to refer to both the field and the body in a query. So when you add a Field for the title named "title", you also add one with a name like "contents", and then you add a field for the body named "body", and then you pass the same data and add another field named "contents". Then, voilla, a search on contents:foo returns matches against the title and the body. > >Let me know, > > >Rob > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]