src/Graviton/DocumentBundle/Service/SolrQuery.php
public function query(SearchNode $node, LimitNode $limitNode = null)
    {
        $client = $this->getClient();

        $query = $client->createQuery($client::QUERY_SELECT);

        // set the weights
        $query->getEDisMax()->setQueryFields($this->solrMap[$this->className]);

        $query->setQuery($this->getSearchTerm($node));

        if ($limitNode instanceof LimitNode) {
            $query->setStart($limitNode->getOffset())->setRows($limitNode->getLimit());
        } else {
            $query->setStart(0)->setRows($this->paginationDefaultLimit);
        }

        $query->setFields(['id']);

        $result = $client->select($query);

        if ($this->requestStack->getCurrentRequest() instanceof Request) {
            $this->requestStack->getCurrentRequest()->attributes->set('totalCount', $result->getNumFound());
            $this->requestStack->getCurrentRequest()->attributes->set('X-Search-Source', 'solr');
        }

        $idList = [];
        foreach ($result as $document) {
            if (isset($document->id)) {
                $idList[] = (string) $document->id;
            } elseif (isset($document->_id)) {
                $idList[] = (string) $document->_id;
            }
        }

        return $idList;
    }
public function query(SearchNode $node, LimitNode $limitNode = null)
    {
        $client = $this->getClient();

        $query = $client->createQuery($client::QUERY_SELECT);

        // set the weights
        $query->getEDisMax()->setQueryFields($this->solrMap[$this->className]);

        $query->setQuery($this->getSearchTerm($node));

        if ($limitNode instanceof LimitNode) {
            $query->setStart($limitNode->getOffset())->setRows($limitNode->getLimit());
        } else {
            $query->setStart(0)->setRows($this->paginationDefaultLimit);
        }

        $query->setFields(['id']);

        $result = $client->select($query);

        if ($this->requestStack->getCurrentRequest() instanceof Request) {
            $this->requestStack->getCurrentRequest()->attributes->set('totalCount', $result->getNumFound());
            $this->requestStack->getCurrentRequest()->attributes->set('X-Search-Source', 'solr');
        }

        $idList = [];
        foreach ($result as $document) {
            if (isset($document->id)) {
                $idList[] = (string) $document->id;
            } elseif (isset($document->_id)) {
                $idList[] = (string) $document->_id;
            }
        }

        return $idList;
    }
public function query ( SearchNode $ node , LimitNode $ limitNode = null ) { $ client = $ this -> getClient ( ) ; $ query = $ client -> createQuery ( $ client :: QUERY_SELECT ) ; // set the weights $ query -> getEDisMax ( ) -> setQueryFields ( $ this -> solrMap [ $ this -> className ] ) ; $ query -> setQuery ( $ this -> getSearchTerm ( $ node ) ) ; if ( $ limitNode instanceof LimitNode ) { $ query -> setStart ( $ limitNode -> getOffset ( ) ) -> setRows ( $ limitNode -> getLimit ( ) ) ; } else { $ query -> setStart ( 0 ) -> setRows ( $ this -> paginationDefaultLimit ) ; } $ query -> setFields ( [ 'id' ] ) ; $ result = $ client -> select ( $ query ) ; if ( $ this -> requestStack -> getCurrentRequest ( ) instanceof Request ) { $ this -> requestStack -> getCurrentRequest ( ) -> attributes -> set ( 'totalCount' , $ result -> getNumFound ( ) ) ; $ this -> requestStack -> getCurrentRequest ( ) -> attributes -> set ( 'X-Search-Source' , 'solr' ) ; } $ idList = [ ] ; foreach ( $ result as $ document ) { if ( isset ( $ document -> id ) ) { $ idList [ ] = ( string ) $ document -> id ; } elseif ( isset ( $ document -> _id ) ) { $ idList [ ] = ( string ) $ document -> _id ; } } return $ idList ; }
executes the search on solr using the rql parsing nodes.

@param SearchNode     $node      search node
@param LimitNode|null $limitNode limit node

@return array an array of just record ids (the ids of the matching documents in solr)
executes the search on solr using the rql parsing nodes .