Suk,
 
You're hitting on a well known limitation with Lucene, and the "solutions"
are work-arounds that may be unacceptable depending on the specifics of your
case.

Solr 4.0 (trunk)'s support for Joins is definitely an up and coming option,
as Mike pointed out.

Kersen's suggestion of using an index just for friends is very good,
although depending on the specifics of your actual needs it may not work or
be unscalable.

Mike also pointed out phrase queries, which will work, but remember to add a
proximity, e.g. "isCool=true gender=male"~50   You'll want to consider the
position increment gap setting in your schema.  A limitation here is that
your text analysis options are limited since all the data is in the same
field.  You're also limited to simple term search; no range queries.

I took a different approach for an app I built. I indexed into separate
fields (i.e. isCool, gender, bloodType) so that I could analyze each of them
appropriately. But I did have to add a filter that basically collapsed all
position offsets within a value to zero, effectively nullifying my ability
to do a phrase query for a particular value. That was acceptable to me and
it can be ameliorated with shingling. Then at search time I used Span
queries and their unique ability to positionally query over more than one
field.  There were some edge conditions that were tricky to debug when I had
a null value, but it was at least fixable with a sentinal value kluge.  

~ David Smiley

-----
 Author: https://www.packtpub.com/solr-1-4-enterprise-search-server/book
--
View this message in context: 
http://lucene.472066.n3.nabble.com/Matching-queries-on-a-per-element-basis-against-a-multivalued-field-tp3217432p3219352.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to