You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Natarajan, Rajeswari" <ra...@sap.com> on 2019/10/16 05:07:57 UTC

Re: [CAUTION] Converting graph query to stream graph query

I need to gather all the children of docid  1 . Root item has parent as null. (Sample data below)

Tried as below

nodes(graphtest,
      walk="1->parent",
      gather="docid",
      scatter="branches, leaves")
      
Response :
{
  "result-set": {
    "docs": [
      {
        "node": "1",
        "collection": "graphtest,",
        "field": "node",
        "level": 0
      },
      {
        "EOF": true,
        "RESPONSE_TIME": 5
      }
    ]
  }
}

Query just gets the  root item and not it's children. Looks like I am missing something obvious . Any pointers , please.

As I said earlier the below graph query gets all the children of docid 1.

fq={!graph from=parent to=docid}docid:"1" 

Thanks,
Rajeswari



On 10/15/19, 12:04 PM, "Natarajan, Rajeswari" <ra...@sap.com> wrote:

    Hi,
    
    
    curl -XPOST -H 'Content-Type: application/json' 'http://localhost:8983/solr/ggg/update' --data-binary '{
    "add" : { "doc" : { "id" : "a", "docid" : "1", "name" : "Root document one" } },
    "add" : { "doc" : { "id" : "b", "docid" : "2", "name" : "Root document two" } },
    "add" : { "doc" : {  "id" : "c", "docid" : "3", "name" : "Root document three" } },
    "add" : { "doc" : {  "id" : "d", "docid" : "11", "parent" : "1", "name" : "First level document 1, child one" } },
    "add" : { "doc" : {  "id" : "e", "docid" : "12", "parent" : "1", "name" : "First level document 1, child two" } },
    "add" : { "doc" : {  "id" : "f", "docid" : "13", "parent" : "1", "name" : "First level document 1, child three" } },
    "add" : { "doc" : {  "id" : "g", "docid" : "21", "parent" : "2", "name" : "First level document 2, child one" } },
    "add" : { "doc" : {  "id" : "h", "docid" : "22", "parent" : "2", "name" : "First level document 2, child two" } },
    "add" : { "doc" : {  "id" : "j", "docid" : "121", "parent" : "12", "name" : "Second level document 12, child one" } },
    "add" : { "doc" : {  "id" : "k", "docid" : "122", "parent" : "12", "name" : "Second level document 12, child two" } },
    "add" : { "doc" : {  "id" : "l", "docid" : "131", "parent" : "13", "name" : "Second level document 13, child three" } },
    "commit" : {}
    }'
    
    
    For the above data , the below query gets all the children of document with docid 1.
    
    http://localhost:8983/solr/graphtest/select?q=*:*&fq={!graph%20from=parent%20to=docid}docid:"1<http://localhost:8983/solr/graphtest/select?q=*:*&fq=%7b!graph%20from=parent%20to=docid%7ddocid:%221>"
    
    
    How can I convert this query into streaming graph query with nodes expression.
    
    Thanks,
    Rajeswari
    
    


Re: [CAUTION] Converting graph query to stream graph query

Posted by Rajeswari Natarajan <ra...@gmail.com>.
Hi Joel,

Thanks for your reply. This is a little different issue. Here the root docs
have parent_id as null. The parent_id of the child will be the docid of the
parent. With the data above  and for the query below


nodes(s4,
      walk="1->parent_s",
      gather="docid_s",
      scatter="branches, leaves")

Below results returned, the result doesn't contain second level children.


{ "result-set": { "docs": [ { "node": "1", "collection": "s4", "field":
"node", "level": 0 }, { "node": "11", "collection": "s4", "field":
"docid_s", "level": 1 }, { "node": "12", "collection": "s4", "field":
"docid_s", "level": 1 }, { "node": "13", "collection": "s4", "field":
"docid_s", "level": 1 }, { "EOF": true, "RESPONSE_TIME": 63 } ] } }

Not sure how to map parent and docid and get all the children(docid) of a
particular parent docid.


Thanks,
Rajeswari

On Fri, Oct 18, 2019 at 2:02 PM Joel Bernstein <jo...@gmail.com> wrote:

> I believe we were debugging why graph results were not being returned in a
> different thread. It looks like the same problem.
>
> Is your Solr instance a straight install or have you moved config files
> from an older version of Solr to a newer version of Solr.
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
>
> On Wed, Oct 16, 2019 at 1:09 AM Natarajan, Rajeswari <
> rajeswari.natarajan@sap.com> wrote:
>
> > I need to gather all the children of docid  1 . Root item has parent as
> > null. (Sample data below)
> >
> > Tried as below
> >
> > nodes(graphtest,
> >       walk="1->parent",
> >       gather="docid",
> >       scatter="branches, leaves")
> >
> > Response :
> > {
> >   "result-set": {
> >     "docs": [
> >       {
> >         "node": "1",
> >         "collection": "graphtest,",
> >         "field": "node",
> >         "level": 0
> >       },
> >       {
> >         "EOF": true,
> >         "RESPONSE_TIME": 5
> >       }
> >     ]
> >   }
> > }
> >
> > Query just gets the  root item and not it's children. Looks like I am
> > missing something obvious . Any pointers , please.
> >
> > As I said earlier the below graph query gets all the children of docid 1.
> >
> > fq={!graph from=parent to=docid}docid:"1"
> >
> > Thanks,
> > Rajeswari
> >
> >
> >
> > On 10/15/19, 12:04 PM, "Natarajan, Rajeswari" <
> > rajeswari.natarajan@sap.com> wrote:
> >
> >     Hi,
> >
> >
> >     curl -XPOST -H 'Content-Type: application/json' '
> > http://localhost:8983/solr/ggg/update' --data-binary '{
> >     "add" : { "doc" : { "id" : "a", "docid" : "1", "name" : "Root
> document
> > one" } },
> >     "add" : { "doc" : { "id" : "b", "docid" : "2", "name" : "Root
> document
> > two" } },
> >     "add" : { "doc" : {  "id" : "c", "docid" : "3", "name" : "Root
> > document three" } },
> >     "add" : { "doc" : {  "id" : "d", "docid" : "11", "parent" : "1",
> > "name" : "First level document 1, child one" } },
> >     "add" : { "doc" : {  "id" : "e", "docid" : "12", "parent" : "1",
> > "name" : "First level document 1, child two" } },
> >     "add" : { "doc" : {  "id" : "f", "docid" : "13", "parent" : "1",
> > "name" : "First level document 1, child three" } },
> >     "add" : { "doc" : {  "id" : "g", "docid" : "21", "parent" : "2",
> > "name" : "First level document 2, child one" } },
> >     "add" : { "doc" : {  "id" : "h", "docid" : "22", "parent" : "2",
> > "name" : "First level document 2, child two" } },
> >     "add" : { "doc" : {  "id" : "j", "docid" : "121", "parent" : "12",
> > "name" : "Second level document 12, child one" } },
> >     "add" : { "doc" : {  "id" : "k", "docid" : "122", "parent" : "12",
> > "name" : "Second level document 12, child two" } },
> >     "add" : { "doc" : {  "id" : "l", "docid" : "131", "parent" : "13",
> > "name" : "Second level document 13, child three" } },
> >     "commit" : {}
> >     }'
> >
> >
> >     For the above data , the below query gets all the children of
> document
> > with docid 1.
> >
> >
> >
> http://localhost:8983/solr/graphtest/select?q=*:*&fq={!graph%20from=parent%20to=docid}docid
> <http://localhost:8983/solr/graphtest/select?q=*:*&fq=%7B!graph%20from=parent%20to=docid%7Ddocid>
> > <
> http://localhost:8983/solr/graphtest/select?q=*:*&fq=%7B!graph%20from=parent%20to=docid%7Ddocid
> >
> > :"1<
> >
> http://localhost:8983/solr/graphtest/select?q=*:*&fq=%7b!graph%20from=parent%20to=docid%7ddocid:%221
> > >"
> >
> >
> >     How can I convert this query into streaming graph query with nodes
> > expression.
> >
> >     Thanks,
> >     Rajeswari
> >
> >
> >
> >
>

Re: [CAUTION] Converting graph query to stream graph query

Posted by Joel Bernstein <jo...@gmail.com>.
I believe we were debugging why graph results were not being returned in a
different thread. It looks like the same problem.

Is your Solr instance a straight install or have you moved config files
from an older version of Solr to a newer version of Solr.

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


On Wed, Oct 16, 2019 at 1:09 AM Natarajan, Rajeswari <
rajeswari.natarajan@sap.com> wrote:

> I need to gather all the children of docid  1 . Root item has parent as
> null. (Sample data below)
>
> Tried as below
>
> nodes(graphtest,
>       walk="1->parent",
>       gather="docid",
>       scatter="branches, leaves")
>
> Response :
> {
>   "result-set": {
>     "docs": [
>       {
>         "node": "1",
>         "collection": "graphtest,",
>         "field": "node",
>         "level": 0
>       },
>       {
>         "EOF": true,
>         "RESPONSE_TIME": 5
>       }
>     ]
>   }
> }
>
> Query just gets the  root item and not it's children. Looks like I am
> missing something obvious . Any pointers , please.
>
> As I said earlier the below graph query gets all the children of docid 1.
>
> fq={!graph from=parent to=docid}docid:"1"
>
> Thanks,
> Rajeswari
>
>
>
> On 10/15/19, 12:04 PM, "Natarajan, Rajeswari" <
> rajeswari.natarajan@sap.com> wrote:
>
>     Hi,
>
>
>     curl -XPOST -H 'Content-Type: application/json' '
> http://localhost:8983/solr/ggg/update' --data-binary '{
>     "add" : { "doc" : { "id" : "a", "docid" : "1", "name" : "Root document
> one" } },
>     "add" : { "doc" : { "id" : "b", "docid" : "2", "name" : "Root document
> two" } },
>     "add" : { "doc" : {  "id" : "c", "docid" : "3", "name" : "Root
> document three" } },
>     "add" : { "doc" : {  "id" : "d", "docid" : "11", "parent" : "1",
> "name" : "First level document 1, child one" } },
>     "add" : { "doc" : {  "id" : "e", "docid" : "12", "parent" : "1",
> "name" : "First level document 1, child two" } },
>     "add" : { "doc" : {  "id" : "f", "docid" : "13", "parent" : "1",
> "name" : "First level document 1, child three" } },
>     "add" : { "doc" : {  "id" : "g", "docid" : "21", "parent" : "2",
> "name" : "First level document 2, child one" } },
>     "add" : { "doc" : {  "id" : "h", "docid" : "22", "parent" : "2",
> "name" : "First level document 2, child two" } },
>     "add" : { "doc" : {  "id" : "j", "docid" : "121", "parent" : "12",
> "name" : "Second level document 12, child one" } },
>     "add" : { "doc" : {  "id" : "k", "docid" : "122", "parent" : "12",
> "name" : "Second level document 12, child two" } },
>     "add" : { "doc" : {  "id" : "l", "docid" : "131", "parent" : "13",
> "name" : "Second level document 13, child three" } },
>     "commit" : {}
>     }'
>
>
>     For the above data , the below query gets all the children of document
> with docid 1.
>
>
> http://localhost:8983/solr/graphtest/select?q=*:*&fq={!graph%20from=parent%20to=docid}docid
> <http://localhost:8983/solr/graphtest/select?q=*:*&fq=%7B!graph%20from=parent%20to=docid%7Ddocid>
> :"1<
> http://localhost:8983/solr/graphtest/select?q=*:*&fq=%7b!graph%20from=parent%20to=docid%7ddocid:%221
> >"
>
>
>     How can I convert this query into streaming graph query with nodes
> expression.
>
>     Thanks,
>     Rajeswari
>
>
>
>