Facing the same problem!! I have noticed it works fine as long as you're looking up the first index position.
Anyone faced similar problem before? On Mon, Apr 28, 2014 at 12:22 PM, Vijay Kokatnur <kokatnur.vi...@gmail.com>wrote: > I have been working on SpanQuery for some time now to look up multivalued > fields and found one more issue - > > Now if a document has following lookup fields among others > > "*BookingRecordId*": [ "100268421", "190131", "8263325" ], > > "*OrderLineType*": [ "13", "1", "11" ], > > Here is the query I construct - > > val q1 = new SpanTermQuery(new Term("BookingRecordId", "100268421")) > val q2 = new SpanTermQuery(new Term("OrderLineType", "13")) > val q2m = new FieldMaskingSpanQuery(q2, "BookingRecordId") > val sp = Array[SpanQuery](q1, q2m) > > val q = new SpanNearQuery(sp, -1, false) > > Query to find element at first index position works fine - > > *{!span} BookingRecordId: 100268421 +OrderLineType:13* > but query to find element at third index position doesn't return any > result. - > > *{!span} BookingRecordId: 8263325 +OrderLineType:11 * > > If I increase the slope to 4 then it returns correct result. But it also > matches BookingRecordId: 100268421 with OrderLineType:11 which is incorrect. > > I thought SpanQuery works for any multiValued field size. Any ideas how I > can fix this? > > Thanks, > -Vijay >