Hi Vijay, After reading the documentation it seems that following query is what you are after. It will return OrderId:345 without matching OrderId:123
SpanQuery q1 = new SpanTermQuery(new Term("BookingRecordId", "234")); SpanQuery q2 = new SpanTermQuery(new Term("OrderLineType", "11")); SpanQuery q2m new FieldMaskingSpanQuery(q2, "BookingRecordId"); Query q = new SpanNearQuery(new SpanQuery[]{q1, q2m}, -1, false); Ahmet On Wednesday, March 26, 2014 10:39 PM, Ahmet Arslan <iori...@yahoo.com> wrote: Hi Vijay, I personally don't understand joins very well. Just a guess may be FieldMaskingSpanQuery could be used? http://blog.griddynamics.com/2011/07/solr-experience-search-parent-child.html Ahmet On Wednesday, March 26, 2014 9:46 PM, Vijay Kokatnur <kokatnur.vi...@gmail.com> wrote: Hi, I am bumping this thread again one last time to see if anyone has a solution. In it's current state, our application is storing child items as multivalue fields. Consider some orders, for example - { OrderId:123 BookingRecordId : ["145", "987", "*234*"] OrderLineType : ["11", "12", "*13*"] ..... } { OrderId:345 BookingRecordId : ["945", "882", "*234*"] OrderLineType : ["1", "12", "*11*"] ..... } { OrderId:678 BookingRecordId : ["444"] OrderLineType : ["11"] ..... } Here, If you look up for an Order with BookingRecordId: 234 And OrderLineType:11. You will get two orders with orderId : 123 and 345, which is correct. You have two arrays in both the orders that satisfy this condition. However, for OrderId:123, the value at 3rd index of OrderLineType array is 13 and not 11( this is for OrderId:345). So orderId 123 should be excluded. This is what I am trying to achieve. I got some suggestions from a solr-user to use FieldsCollapsing, Join, Block-join or string concatenation. None of these approaches can be used without re-indexing schema. Has anyone found a non-invasive solution for this? Thanks, -Vijay