I tried this on another machine with a clean index. I was able to get the query 
to work. Thank you. 

Couple of related questions. 
1) I was able to get this to work on a single shard machine. But I am not able 
to get this query to work on Solr with two shards (SorlCloud). Any reason why 
this does not work with SolrCloud? 
2) The query pattern you supplied does not appear in the documentation. Do you 
know of any reason why the information in the documentation does not work and 
does not mention your pattern? 
https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers
 

Thanks again. 


----- Original Message -----

From: "Mikhail Khludnev" <mkhlud...@griddynamics.com> 
To: "solr-user" <solr-user@lucene.apache.org> 
Sent: Thursday, March 24, 2016 11:31:11 AM 
Subject: Re: SyntaxError - Block Join Parent Query 

I suggest to add debugQuery=true and fl=*,[child ...] doc transformer. And 
come back with response. 

On Thu, Mar 24, 2016 at 3:23 PM, Charles Sanders <csand...@redhat.com> 
wrote: 

> Ah yes. Thank you. Made the correction and I do not get the SyntaxError. 
> However, it does not apply the child filter. The query should return only 
> TestParent4. But it is returning TestParent2, TestParent3 and TestParent4. 
> All of these meet the parent portion of the query (+blue). But only 
> TestParent4 should meet the child portion of the query. 
> 
> q=+blue +{!parent 
> which="documentKind:TestParent"v=$childq}&childq=portal_product:("red hat") 
> 
> 
> { 
> "responseHeader":{ 
> "status":0, 
> "QTime":15, 
> "params":{ 
> "indent":"true", 
> "q":" blue {!parent which=\"documentKind:TestParent\"v=$childq}", 
> "childq":"portal_product:(\"red hat\")", 
> "wt":"json"}}, 
> "response":{"numFound":2733,"start":0,"maxScore":3.0138793,"docs":[ 
> { 
> "documentKind":"TestParent", 
> "uri":"https://ping/pong/testparent4";, 
> "view_uri":"https://ping/pong/testparent4";, 
> "id":"TestParent4", 
> "allTitle":"blue", 
> "sortTitle":"blue", 
> "_version_":1529622873461751808, 
> "_root_":["https://ping/pong/testparent4";], 
> "timestamp":"2016-03-23T19:40:48.211Z", 
> "language":"en"}, 
> { 
> "documentKind":"TestParent", 
> "uri":"https://ping/pong/testparent3";, 
> "view_uri":"https://ping/pong/testparent3";, 
> "id":"TestParent3", 
> "allTitle":"blue", 
> "sortTitle":"blue", 
> "_version_":1529622308758487040, 
> "_root_":["https://ping/pong/testparent3";], 
> "timestamp":"2016-03-23T19:31:49.668Z", 
> "language":"en"}, 
> { 
> "documentKind":"TestParent", 
> "uri":"https://ping/pong/testparent2";, 
> "view_uri":"https://ping/pong/testparent2";, 
> "id":"TestParent2", 
> "allTitle":"blue", 
> "sortTitle":"blue", 
> "_version_":1529622293809987584, 
> "_root_":["https://ping/pong/testparent2";], 
> "timestamp":"2016-03-23T19:31:35.408Z", 
> "language":"en"} 
> 
> ----- Original Message ----- 
> 
> From: "Mikhail Khludnev" <mkhlud...@griddynamics.com> 
> To: "solr-user" <solr-user@lucene.apache.org> 
> Sent: Wednesday, March 23, 2016 5:34:31 PM 
> Subject: Re: SyntaxError - Block Join Parent Query 
> 
> On Thu, Mar 24, 2016 at 12:16 AM, Charles Sanders <csand...@redhat.com> 
> wrote: 
> 
> > Thanks for the quick reply. But I'm not sure I understand. Did I do 
> > something wrong?? 
> > 
> Absolutely 
> 'portal_product"red hat")' 
> You omit a colon and opening bracket after a field name, don't you? 
> 
> 
> > 
> > 
> > 
> /select?q=+blue%20+{!parent%20which=%22documentKind:TestParent%22%20v=$childq}&childq=portal_product%22red%20hat%22)
>  
> > 
> > <response> 
> > <lst name =" responseHeader " > 
> > <int name =" status " > 400 </int> 
> > <int name =" QTime " > 2 </int> 
> > <lst name =" params " > 
> > <str name =" q " > 
> > blue {!parent which="documentKind:TestParent" v=$childq} 
> > </str> 
> > <str name =" childq " > portal_product"red hat") </str> 
> > </lst> 
> > </lst> 
> > <lst name =" error " > 
> > <str name =" msg " > 
> > org.apache.solr.search.SyntaxError: Cannot parse 'portal_product"red 
> > hat")': Encountered " ")" ") "" at line 1, column 23. Was expecting one 
> of: 
> > <EOF> <AND> ... <OR> ... <NOT> ... "+" ... "-" ... <BAREOPER> ... "(" ... 
> > "*" ... "^" ... <QUOTED> ... <TERM> ... <FUZZY_SLOP> ... <PREFIXTERM> ... 
> > <WILDTERM> ... <REGEXPTERM> ... "[" ... "{" ... <LPARAMS> ... <NUMBER> 
> ... 
> > </str> 
> > <int name =" code " > 400 </int> 
> > </lst> 
> > </response> 
> > 
> > ----- Original Message ----- 
> > 
> > From: "Mikhail Khludnev" <mkhlud...@griddynamics.com> 
> > To: "solr-user" <solr-user@lucene.apache.org> 
> > Sent: Wednesday, March 23, 2016 5:02:29 PM 
> > Subject: Re: SyntaxError - Block Join Parent Query 
> > 
> > On Wed, Mar 23, 2016 at 11:09 PM, Charles Sanders <csand...@redhat.com> 
> > wrote: 
> > 
> > > I'm getting a SyntaxError which I do not understand when I execute a 
> > block 
> > > join parent query. I'm running Solr5.2.1, with 2 shards. The problem 
> > > appears to be in that portion of the query that filters the child 
> > document. 
> > > Any insight as to where I made the error is greatly appreciated. 
> > > 
> > > This query produces an error: 
> > > q=+blue +{!parent which="documentKind:TestParent"}portal_product:("red 
> > > hat") 
> > > -- should return TestParent4 
> > > 
> > q=+blue +{!parent which="documentKind:TestParent" 
> > v=$childq}&childq=portal_product:("red hat") 
> > 
> > 
> > > However, this query works: 
> > > q=+blue +{!parent which="documentKind:TestParent"}portal_product:rhel 
> > > -- should return TestParent2 
> > > 
> > > Sample data and schema information below: 
> > > { 
> > > "documentKind": "TestParent", 
> > > "uri": "https://ping/pong/testparent1";, 
> > > "view_uri": "https://ping/pong/testparent1";, 
> > > "id": "TestParent1", 
> > > "allTitle": "gold", 
> > > "allText": "gold", 
> > > "contents": "gold", 
> > > "_childDocuments_": [ 
> > > { 
> > > "documentKind": "TestChild", 
> > > "uri": "testchild1", 
> > > "id": "testchild1", 
> > > "portal_product_version": "6", 
> > > "portal_product": "rhel" 
> > > } 
> > > ] 
> > > } 
> > > 
> > > { 
> > > "documentKind": "TestParent", 
> > > "uri": "https://ping/pong/testparent2";, 
> > > "view_uri": "https://ping/pong/testparent2";, 
> > > "id": "TestParent2", 
> > > "allTitle": "blue", 
> > > "allText": "blue", 
> > > "contents": "blue", 
> > > "_childDocuments_": [ 
> > > { 
> > > "documentKind": "TestChild", 
> > > "uri": "testchild2", 
> > > "id": "testchild2", 
> > > "portal_product_version": "6", 
> > > "portal_product": "rhel" 
> > > } 
> > > ] 
> > > } 
> > > 
> > > { 
> > > "documentKind": "TestParent", 
> > > "uri": "https://ping/pong/testparent3";, 
> > > "view_uri": "https://ping/pong/testparent3";, 
> > > "id": "TestParent3", 
> > > "allTitle": "blue", 
> > > "allText": "blue", 
> > > "contents": "blue", 
> > > "_childDocuments_": [ 
> > > { 
> > > "documentKind": "TestChild", 
> > > "uri": "testchild3", 
> > > "id": "testchild3", 
> > > "portal_product_version": "3", 
> > > "portal_product": "rhev" 
> > > } 
> > > ] 
> > > } 
> > > 
> > > { 
> > > "documentKind": "TestParent", 
> > > "uri": "https://ping/pong/testparent4";, 
> > > "view_uri": "https://ping/pong/testparent4";, 
> > > "id": "TestParent4", 
> > > "allTitle": "blue", 
> > > "allText": "blue", 
> > > "contents": "blue", 
> > > "_childDocuments_": [ 
> > > { 
> > > "documentKind": "TestChild", 
> > > "uri": "testchild4", 
> > > "id": "testchild4", 
> > > "portal_product_version": "3", 
> > > "portal_product": "red hat" 
> > > } 
> > > ] 
> > > } 
> > > 
> > > <field name="documentKind" type="string" indexed="true" stored="true" 
> > > required="true" /> 
> > > <field name="uri" type="string" indexed="true" stored="true" 
> > > required="true"/> 
> > > <field name="view_uri" type="string" indexed="true" stored="true" /> 
> > > <field name="id" type="string" indexed="true" stored="true" /> 
> > > <field name="allTitle" type="text_std" indexed="true" stored="true" /> 
> > > <field name="allText" type="text_std" indexed="true" stored="false" 
> > > multiValued="true" termVectors="true" /> 
> > > <field name="contents" type="text_std" indexed="true" stored="false" 
> > > multiValued="true" termVectors="true" /> 
> > > <field name="portal_product_version" type="string" indexed="true" 
> > > stored="true"/> 
> > > <field name="portal_product" type="string" indexed="true" 
> stored="true"/> 
> > > 
> > 
> > 
> > 
> > -- 
> > Sincerely yours 
> > Mikhail Khludnev 
> > Principal Engineer, 
> > Grid Dynamics 
> > 
> > <http://www.griddynamics.com> 
> > <mkhlud...@griddynamics.com> 
> > 
> > 
> 
> 
> -- 
> Sincerely yours 
> Mikhail Khludnev 
> Principal Engineer, 
> Grid Dynamics 
> 
> <http://www.griddynamics.com> 
> <mkhlud...@griddynamics.com> 
> 
> 


-- 
Sincerely yours 
Mikhail Khludnev 
Principal Engineer, 
Grid Dynamics 

<http://www.griddynamics.com> 
<mkhlud...@griddynamics.com> 

Reply via email to