Yes, in terms of what you probably mean, but your first
example would index one token "bar1bar2". But if you
changed your first example to (note space): they would
be entirely equivalent.
doc.add(new Field("foo",
"bar1 bar2",
Field.Store.YES,
Field.Index.ANALYZED));
One note: The rather technical difference between the two methods
is that multiple calls to index the same field add PositionIncrementGap
to the first token of calls 2-n. This defaults to 1, so it doesn't change
anything unless you change it in your analyzer. Don't worry about it
yet <G>...
Best
Erick
On Wed, Oct 15, 2008 at 1:41 PM, Rafael Almeida <[EMAIL PROTECTED]>wrote:
> I didn't quite understand the Document documentation so well, the
> documentation says:
>
> "Adds a field to a document. Several fields may be added with the same
> name. In this case, if the fields are indexed, their text is treated
> as though appended for the purposes of search."
>
> Would
>
> doc.add(new Field("foo",
> "bar1" + "bar2",
> Field.Store.YES,
> Field.Index.ANALYZED));
>
> be different in any way than
>
> doc.add(new Field("foo",
> "bar1",
> Field.Store.YES,
> Field.Index.ANALYZED));
> doc.add(new Field("foo",
> "bar2",
> Field.Store.YES,
> Field.Index.ANALYZED));
> ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>