lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: Only last field indexed
Date Wed, 08 Oct 2008 12:58:05 GMT
Kalani:

You are mistaken to think this is not possible. In fact
it is explicitly supported, and I've done it in many
situations. These two are entirely identical if you
use an analyzer that breaks the stream up on
words.

doc = new Document()
doc.add("myfield", "some text", blah blah)
doc.add("myfield", "here is more text", blah blah)
indexwriter.addDocument(doc)


and


doc = new Document()
doc.add("myfield", "some text here is more text", blah blah)
indexwriter.addDocument(doc)


except for a rather technical issue that if your PositionIncrementGap is
greater than one (say 10), the first form will have the token "here"
at offset 12  and the second form will have the token "here" at offset 2.
Which is useful and why the PositionIncrementGap is there in
the first place.

Note that they would probably not be identical with, say KeywordAnalyzer
though.

Which you can easily check yourself with Luke....

Best
Erick




On Wed, Oct 8, 2008 at 5:01 AM, Kalani Ruwanpathirana <kalanir@gmail.com>wrote:

> You are doing this kind of a thing?
>
> document.add(new Field("id", id1, Field.Store.YES, Field.Index.TOKENIZED));
> document.add(new Field("id", id2, Field.Store.YES, Field.Index.TOKENIZED));
>
> I doubt whether this is possible. What happen to the value id1 when the
> value id2 added to the same filed? merged or overridden?
> Just curious.
>
>
> Kalani.
>
> On Tue, Oct 7, 2008 at 11:53 PM, Erick Erickson <erickerickson@gmail.com
> >wrote:
>
> > Let's see the indexing code. It is perfectly reasonable to
> > add data to a field multiple times, so I suspect you're
> > doing something wrong.....
> >
> > What evidence do you have that it's only the last field that's
> > indexed?
> >
> > Best
> > Erick
> >
> > On Tue, Oct 7, 2008 at 1:28 PM, John Griffin <griffij@sosstaffing.com
> > >wrote:
> >
> > > Guys,
> > >
> > > I'm adding multiple fields with the same name to a document as
> Store.YES,
> > > Indexed.TOKENIZED and it seems that only the last field entered is
> > indexed.
> > > I read about this somewhere her but now I can't find it, naturally. Is
> > > there
> > > a work around? does someone have a pointer to this discussion? Can
> > someone
> > > help?
> > >
> > > Thanks in advance.
> > >
> > > John G.
> > >
> >
>
>
>
> --
> Kalani Ruwanpathirana
> Department of Computer Science & Engineering
> University of Moratuwa
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message