/** * returns the query * * @return string */ public function getQuery() { // if no search field if ($this->searchFields == null) { return parent::getQuery(); } $queryStrings = array(); foreach ($this->searchFields as $searchField) { $queryStrings[] = $searchField->toQuery(); } return join(' AND ', $queryStrings); }
/** * * @param SolrQuery $query * @return array resultados de la busqueda */ function executeQuery($query) { if ($query instanceof SolrQuery) { $solrUrl = $this->getHost(); $queryData = $query->getQuery(); $file = $solrUrl . '/select?'; $aux = array(); foreach ($queryData as $queryType => $currentQuery) { $aux[] = $queryType . '=' . urlencode($currentQuery); } $queryPart = implode('&', $aux); $file = $file . $queryPart . '&wt=phps'; $serializedResult = file_get_contents($file); $result = unserialize($serializedResult); return $result; } else { throw new Exception('not allowed class'); } }