lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dragon Fly <dragon-fly...@hotmail.com>
Subject RE: Fields with multiple values...
Date Thu, 12 Feb 2009 17:58:06 GMT

I'll think about your ideas and see which one works best for my project.  Thank you.

> Date: Wed, 11 Feb 2009 18:11:58 -0700
> Subject: Re: Fields with multiple values...
> From: mark.a.ferguson@gmail.com
> To: java-user@lucene.apache.org
> 
> One approach is to use dynamic fields, making the value of the second field
> part of the name of the first field. So for example, you would have:
> 
> doc.Add (new Field ("Field1_A", "C", Field.Store.YES,
> Field.Index.UN_TOKENIZED));
> doc.Add (new Field ("Field1_B", "D", Field.Store.YES,
> Field.Index.UN_TOKENIZED));
> 
> Whether this is a viable option really depends on how many fields we're
> talking about and what sort of data you're indexing. I use this approach on
> my project for storing users' individual data about a URL inside a single
> document, by appending the user id to the field name. So I have, for
> example, bookmark_title_29:"My Bookmark", and bookmark_title_35:"Another
> bookmark" in the same document, and I can search bookmark titles by specific
> users.
> 
> On Wed, Feb 11, 2009 at 3:55 PM, Dragon Fly <dragon-fly999@hotmail.com>wrote:
> 
> >
> > Hi,
> >
> > Let's say I have a single document with 2 fields (namely Field1 and
> > Field2).  2 values are added to each field like below.
> >
> > // Add 2 values to Field1.
> > doc.Add (new Field ("Field1", "A", Field.Store.YES,
> > Field.Index.UN_TOKENIZED));
> > doc.Add (new Field ("Field1", "B", Field.Store.YES,
> > Field.Index.UN_TOKENIZED));
> >
> > // Add 2 values to Field2.
> > doc.Add (new Field ("Field2", "C", Field.Store.YES,
> > Field.Index.UN_TOKENIZED));
> > doc.Add (new Field ("Field2", "D", Field.Store.YES,
> > Field.Index.UN_TOKENIZED));
> >
> > I'd like to get a hit if I do:
> >    Field1:A AND Field2:C
> > This is fine because that's how Lucene works.  However, I do not want to
> > get a hit if I do:
> >    Field1:A AND Field2:D
> > The reason that I don't want a hit is because A is the first element in
> > Field1 and D is the second element in Field2.  I only want a hit when both
> > values are at the same array index.  Is there a way to do this? Thank you in
> > advance for your help.
> >
> > _________________________________________________________________
> > Windows Live™: E-mail. Chat. Share. Get more ways to connect.
> > http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_allup_explore_022009

_________________________________________________________________
Windows Live™: Keep your life in sync. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_022009
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message