Dragon Fly wrote:
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.
With a bit of fudging, you may be able to use a SpanNearQuery to do this -- though you'll need to change your analyzer's positionIncrementGap, and depending on how many tokens you'll have for each field (if it varies between fields) you may need to patch Lucene to change the way the gaps are calculated.
I've done a prototype of exactly this (SpanNearQuery and analyzer changes) for a very similar situation here and it works BRILLIANTLY -- massively, massively faster for us than indexing a new document for each set of 'subfields'.
I've put some patches against https://issues.apache.org/jira/browse/LUCENE-1494 -- I think this approach might work for you. Let me know if you need clarification.
Cheers, Paul --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org