Hi,

There is a workaround with dynamic fields. Trick is you embed data/into into a 
field name. Normally data is assigned to field value. In this approach field 
name contains data too.  

Instead of multivalued cat field, define cat_* dynamic field. 
https://cwiki.apache.org/confluence/display/solr/Dynamic+Fields

prod: p
cat : catA,catB,catC

becomes

prod: p
cat_1 : catA
cat_2 : catB
cat_3 : catC

return prod where  (cat_1 == catA) or (cat_2==catB).

becomes q=cat_1:catA OR cat_2:catB


There is another solution (FieldMaskingSpanQuery) but it requires writing 
custom java code (solr plugin)
http://blog.griddynamics.com/2011/07/solr-experience-search-parent-child.html




On Monday, June 9, 2014 9:54 PM, kritarth.anand <kritarth.an...@gmail.com> 
wrote:
hi,

prod: p
cat : catA,catB,catC

prod :q 
cat : catB, catC,catD

My schema consists of documents with uid : 'prod's and then they belong can
to multiple categories called 'cat' and which are represented as a
multivalued field. For a particular kind of query I need to access
individual elements separately as in 

return prod where  (cat_1 == catA) or (cat_2==catB). is there a way by which
i can do that?

thanks in advance



--
View this message in context: 
http://lucene.472066.n3.nabble.com/accessing-individual-elements-of-a-multivalued-field-tp4140862.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to