lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven A Rowe <sar...@syr.edu>
Subject RE: Fields with multiple values...
Date Wed, 11 Feb 2009 23:06:28 GMT
Hi Dragon Fly,

You could split the original document into multiple Lucene Documents,
one for each array index, all sharing the same "DocID" field value.

Then your queries "just work".  But you'd have to do result
consolidation, removing duplicate original docs when you get matches at
multiple array indexes from the same original doc.

Steve

On 2/11/2009 at 5:56 PM, Dragon Fly 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.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message