On Jan 9, 2007, at 10:24 PM, David wrote:
Hi all: can we add duplicate field in Lucene like the following:
Yup, no problem!
doc.add(new Field("author", "author1", Field.Store.YES, Field.Index.UN_TOKENIZED)); doc.add(new Field("author", "author2", Field.Store.YES, Field.Index.UN_TOKENIZED)); How will Lucene act?
It'll be as if you did concatenate them yourself into a single field, with a slight caveat. Multiple same-named fields can have a virtual positional gap added to them (see the setPositionGap feature). This can prevent phrases searching across instances of the field. For example, if you indexed "Samual Clemens" and "Mark Twain" as two separate "author" fields, but left the default position gap setting, someone could query for "clemons twain" and get a hit as an exact phrase match.
if I want add two authors to the index , how can I do? except concat the authors' string, because maybe I should support Range search for datetime.
You'd do it just the way you're doing. Erik --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]