Currently gatherNodes only works on single value fields. You can seed a
gatherNodes with a facet() expression which works with multi-value fields,
but after that it only works with single value fields.

So you would have to index the data as a graph like this:

id, concept1, participant1
id, concept1, participant2
id, concept2, participant1
id, concept2, participant3
id, concept3, participant2
....

Then you walk the graph like this:

gatherNodes(mydata,
                      gatheNodes(mydata, walk="concept1->conceptID",
gather="participantID")
                      walk="node->particpantID",
                      gather="conceptID")

This is a two step graph expression:
1) Gathers all the participantID's where concept1 is in the conceptID
field.
2) Gathers all the conceptID's for the participantID's gathered in step 1.

Let me know if you have other questions about how to structure the data or
run the queries.








Adding multi-value field support is a fairly high priority so I would
expect this to be coming in a future release.




Joel Bernstein
http://joelsolr.blogspot.com/

On Fri, Mar 10, 2017 at 5:15 PM, Pratik Patel <pra...@semandex.net> wrote:

> I am trying to do a graph traversal query using gatherNode function. I am
> seeding a streaming expression to get some documents and then I am trying
> to map their ids(conceptid) to a multi valued field "participantIds" and
> gather nodes.
>
> Here is the query I am doing.
>
>
> gatherNodes(collection1,
> > search(collection1,q="*:*",fl="conceptid",sort="conceptid
> > asc",fq=storeid:"524efcfd505637004b1f6f24",fq=tags:"Project"),
> > walk=conceptid->participantIds,
> > gather="conceptid")
>
>
> The field participantIds is a multi valued field. This is the field which
> holds connections between the documents. When I execute this query, I get
> exception as below.
>
>
> { "result-set": { "docs": [ { "EXCEPTION":
> "java.util.concurrent.ExecutionException: java.lang.RuntimeException:
> java.io.IOException: java.util.concurrent.ExecutionException:
> java.io.IOException: -->
> http://169.254.40.158:8081/solr/collection1_shard1_replica1/:can not sort
> on multivalued field: participantIds", "EOF": true, "RESPONSE_TIME": 15 } ]
> } }
>
>
> Does this mean you can not look into multivalued fields in graph traversal
> query? In our solr index, we have documents having "conceptid" field which
> is id and we have participantIds which is a multivalued field storing
> connections of that documents to other documents. I believe we need to have
> one field in document which stores connections of that document so that
> graph traversal is possible. If not, what is the other the way to index
> graph data and use graph traversal. I am trying to explore graph traversal
> and am new to it. Any help would be appreciated.
>
> Thanks,
> Pratik
>

Reply via email to