1--TEST-- 2SolrClient::query() - Query child documents SolrObject (Integ) 3--SKIPIF-- 4<?php 5include 'skip.if.server_not_configured.inc'; 6?> 7--FILE-- 8<?php 9 10require_once "bootstrap.inc"; 11 12$options = array ( 13 'hostname' => SOLR_SERVER_HOSTNAME, 14 'login' => SOLR_SERVER_USERNAME, 15 'password' => SOLR_SERVER_PASSWORD, 16 'port' => SOLR_SERVER_PORT, 17 'path' => SOLR_SERVER_STORE_PATH, 18 'wt' => 'xml' 19); 20 21$client = new SolrClient ( $options ); 22 23$query = new SolrQuery (); 24 25$query->setQuery ( 'id:1 AND {!parent which=$parentFilter}' ); 26$query->setParam ( 'parentFilter', 'content_type_s:product' ); 27$query->addFilterQuery('{!parent which=$parentFilter}'); 28 29$query->addField ( '*' ); 30$query->addField ( '[child parentFilter=$parentFilter]' ); 31 32$query->setStart ( 0 ); 33 34$query->setRows ( 50 ); 35$queryResponse = $client->query ( $query ); 36 37$response = $queryResponse->getResponse (); 38echo "----XML----" . PHP_EOL; 39var_dump($response->response->docs[0]->_childDocuments_[0]->id); 40 41echo "----JSON----" . PHP_EOL; 42$options['wt'] = 'json'; 43$client = new SolrClient ( $options ); 44$queryResponse = $client->query($query); 45$response = $queryResponse->getResponse (); 46var_dump($response->response->docs[0]->_childDocuments_[0]->id); 47?> 48--EXPECT-- 49----XML---- 50string(9) "IMM-HOW-S" 51----JSON---- 52string(9) "IMM-HOW-S"