I'm sure someone asked this before, but I couldn't find a previous post regarding this.
The problem: Let's say that I have a multivalued field called myFriends that tokenizes on whitespaces. Basically, I'm treating it like a List of Lists (attributes of friends): Document A: myFriends = [ "isCool=true SOME_JUNK_HERE gender=male bloodType=A" ] Document B: myFriends = [ "isCool=true SOME_JUNK_HERE gender=female bloodType=O", "isCool=false SOME_JUNK_HERE gender=male bloodType=AB" ] Now, let's say that I want to search for all the cool male friends I have. Naively, I can query q=myFriends:isCool=true+AND+myFriends:gender=male. However, this returns documents A and B, because the two criteria are tested against the entire collection, rather than against individual elements. I could work around this by not tokenizing on whitespaces and using wildcards: q=myFriends:isCool=true\ *\ gender=male but this becomes painful when the query becomes more complex. What if I wanted to find cool friends who are either type A or type O? I could do q=myFriends:(isCool=true\ *\ bloodType=A+OR+isCool=true\ *\ bloodType=O). And you can see that the number of criteria will just explode as queries get more complex. There are other methods that I've considered, such as duplicating documents for every friend, like so: Document A1: myFriend = [ "isCool=true", "gender=male", "bloodType=A" ] Document B1: myFriend = [ "isCool=true", "gender=female", "bloodType=O" ] Document B2: myFriend = [ "isCool=false", "gender=male", "bloodType=AB" ] but this would be less than desirable. I would like to hear any other ideas around solving this problem, but going back to the original question, is there a way to match multiple criteria on a per-item basis rather than against the entire multifield? -- View this message in context: http://lucene.472066.n3.nabble.com/Matching-queries-on-a-per-element-basis-against-a-multivalued-field-tp3217432p3217432.html Sent from the Solr - User mailing list archive at Nabble.com.