/** * Build request for a select query * * @param Solarium_Query $query * @return Solarium_Client_Request */ public function build($query) { $request = new Solarium_Client_Request(); $request->setHandler($query->getHandler()); $request->addParams($query->getParams()); $request->addParam('wt', 'json'); return $request; }
/** * Render a qparser plugin call * * @param string $name * @param array $params * @param boolean $dereferenced * @return string */ public function qparser($name, $params = array(), $dereferenced = false) { if ($dereferenced) { if (!$this->_query) { throw new Solarium_Exception('Dereferenced params can only be used in a Solarium_Query_Helper instance retrieved from the query ' . 'by using the getHelper() method, this instance was manually created'); } foreach ($params as $paramKey => $paramValue) { $this->_derefencedParamsLastKey++; $derefKey = 'deref_' . $this->_derefencedParamsLastKey; $this->_query->addParam($derefKey, $paramValue); $params[$paramKey] = '$' . $derefKey; } } $output = '{!' . $name; foreach ($params as $key => $value) { $output .= ' ' . $key . '=' . $value; } $output .= '}'; return $output; }
/** * Creates a result object * * @param Solarium_Query $query * @param array Solarium_Client_Response $response * @return Solarium_Result */ public function createResult($query, $response) { $pluginResult = $this->_callPlugins('preCreateResult', array($query, $response), true); if ($pluginResult !== null) { return $pluginResult; } $resultClass = $query->getResultClass(); $result = new $resultClass($this, $query, $response); $this->_callPlugins('postCreateResult', array($query, $response, $result)); return $result; }
/** * Event hook to capture querytype * * @param Solarium_Query $query * @return void */ public function preCreateRequest($query) { $this->_queryType = $query->getType(); }