Wow that's an interesting expression! The problem is that you are trying to fetch using the ancestors field, which is multi-valued. fetch doesn't support multi-value join keys. I never thought someone might try to do that.
So , your attempting to get the concept names for ancestors? Can you explain a little more about the use case? Joel Bernstein http://joelsolr.blogspot.com/ On Tue, Mar 14, 2017 at 11:08 AM, Pratik Patel <pra...@semandex.net> wrote: > I have two types of documents in my index. eventLink and concepttData. > > eventLink ---- { ancestors:[<id1>,<id2>] } > conceptData-----{ id:id1, conceptid, concept_name .....<some more data> } > > Both are in same collection. > In my query, I am doing a gatherNodes query wrapped in some other function > and ultimately I am getting a bunch of eventLink documents. Now, I am > trying to get conceptData document for each id specified in eventLink's > ancestors field. I am trying to do that using fetch() function. Here is > simplified form of my query. > > fetch(collection1, > > function to get eventLinks, > > fl="concept_name", > > on="ancestors=conceptid" > > ) > > > On executing this query, I am getting back same set of documents which are > results of my streaming expression containing gatherNodes() function. No > fields are added to the tuples. From documentation, it seems like fetch > would fetch additional data and add it to the tuples. However, that is not > happening. Resulting tuples does not have concept_name field in them. What > am I missing here? I really need to get this additional data from one solr > query so that I don't have to iterate over the eventLinks and get > additional data by individual queries. That would badly impact performance. > Any suggestions? > > Here is my actual query and the response. > > > fetch(collection1, > > having( > > gatherNodes(collection1, > > search(collection1,q="*:*",fl="conceptid",sort="conceptid > > asc",fq=storeid:"524efcfd505637004b1f6f24",fq=tags:"Company",fq=tags:" > Prospects2", > > qt="/export"), > > walk=conceptid->eventParticipantID, > > gather="eventID", > > trackTraversal="true", scatter="leaves", > > count(*) > > ), > > gt(count(*),1) > > ), > > fl="concept_name", > > on="ancestors=conceptid" > > ) > > > > Response : > > { > > "result-set": { > > "docs": [ > > { > > "node": "524f03355056c8b53b4ed199", > > "field": "eventID", > > "level": 1, > > "count(*)": 2, > > "collection": "collection1", > > "ancestors": [ > > "524f02845056c8b53b4e9871", > > "524f02755056c8b53b4e9269" > > ] > > }, > > ......... > > } > > > Thanks, > Pratik >