public function query($index, array $filters = null,
        array $queries = null, array $fieldWeights = null,
        $limit = 20, $offset = 0
    ) {
        $sphinxClient = $this->getSphinxClient();
        $sphinxClient->SetLimits($offset, $limit);
        if (null !== $filters) {
            foreach ($filters as $filter) {
                if (!isset($filter['key'])) {
                    // Filtro existe mas sem key
                }
                if (
                    array_key_exists('min', $filter) &&
                    array_key_exists('max', $filter)
                ) {
                    $sphinxClient->SetFilterRange(
                                  $filter['key'],
                        (integer) $filter['min'],
                        (integer) $filter['max']
                    );
                } else {
                    if (!isset($filter['values']) || !is_array($filter['values'])) {
                        //Filtro existe mas sem valor;
                    }
                    $sphinxClient->SetFilter(
                        $filter['key'],
                        $filter['values']
                    );
                }
            }
        }
        if (null !== $queries) {
            foreach ($queries as $key => $queryInfo) {
                $query = $this->implodeQueryValues($queryInfo);

                if (array_key_exists('countableAttributes', $queryInfo)) {
                    $array = $queryInfo['countableAttributes'];
                    if (!is_array($array)) {
                        $array = [$array];
                    }

                    $sphinxClient->addFacetedQuery($query, $index, $array);
                } else {
                    $sphinxClient->AddQuery($query, $index);
                }
            }
        }

        if (null !== $fieldWeights) {
            $sphinxClient->SetFieldWeights($fieldWeights);
        }

        $result = $this->getResult($sphinxClient);

        return $result;
    }
public function query($index, array $filters = null,
        array $queries = null, array $fieldWeights = null,
        $limit = 20, $offset = 0
    ) {
        $sphinxClient = $this->getSphinxClient();
        $sphinxClient->SetLimits($offset, $limit);
        if (null !== $filters) {
            foreach ($filters as $filter) {
                if (!isset($filter['key'])) {
                    // Filtro existe mas sem key
                }
                if (
                    array_key_exists('min', $filter) &&
                    array_key_exists('max', $filter)
                ) {
                    $sphinxClient->SetFilterRange(
                                  $filter['key'],
                        (integer) $filter['min'],
                        (integer) $filter['max']
                    );
                } else {
                    if (!isset($filter['values']) || !is_array($filter['values'])) {
                        //Filtro existe mas sem valor;
                    }
                    $sphinxClient->SetFilter(
                        $filter['key'],
                        $filter['values']
                    );
                }
            }
        }
        if (null !== $queries) {
            foreach ($queries as $key => $queryInfo) {
                $query = $this->implodeQueryValues($queryInfo);

                if (array_key_exists('countableAttributes', $queryInfo)) {
                    $array = $queryInfo['countableAttributes'];
                    if (!is_array($array)) {
                        $array = [$array];
                    }

                    $sphinxClient->addFacetedQuery($query, $index, $array);
                } else {
                    $sphinxClient->AddQuery($query, $index);
                }
            }
        }

        if (null !== $fieldWeights) {
            $sphinxClient->SetFieldWeights($fieldWeights);
        }

        $result = $this->getResult($sphinxClient);

        return $result;
    }
public function query ( $ index , array $ filters = null , array $ queries = null , array $ fieldWeights = null , $ limit = 20 , $ offset = 0 ) { $ sphinxClient = $ this -> getSphinxClient ( ) ; $ sphinxClient -> SetLimits ( $ offset , $ limit ) ; if ( null !== $ filters ) { foreach ( $ filters as $ filter ) { if ( ! isset ( $ filter [ 'key' ] ) ) { // Filtro existe mas sem key } if ( array_key_exists ( 'min' , $ filter ) && array_key_exists ( 'max' , $ filter ) ) { $ sphinxClient -> SetFilterRange ( $ filter [ 'key' ] , ( integer ) $ filter [ 'min' ] , ( integer ) $ filter [ 'max' ] ) ; } else { if ( ! isset ( $ filter [ 'values' ] ) || ! is_array ( $ filter [ 'values' ] ) ) { //Filtro existe mas sem valor; } $ sphinxClient -> SetFilter ( $ filter [ 'key' ] , $ filter [ 'values' ] ) ; } } } if ( null !== $ queries ) { foreach ( $ queries as $ key => $ queryInfo ) { $ query = $ this -> implodeQueryValues ( $ queryInfo ) ; if ( array_key_exists ( 'countableAttributes' , $ queryInfo ) ) { $ array = $ queryInfo [ 'countableAttributes' ] ; if ( ! is_array ( $ array ) ) { $ array = [ $ array ] ; } $ sphinxClient -> addFacetedQuery ( $ query , $ index , $ array ) ; } else { $ sphinxClient -> AddQuery ( $ query , $ index ) ; } } } if ( null !== $ fieldWeights ) { $ sphinxClient -> SetFieldWeights ( $ fieldWeights ) ; } $ result = $ this -> getResult ( $ sphinxClient ) ; return $ result ; }
Executa Queries.

@see \Gpupo\Search\Query\FiltersAbstract::toArray()          Filter Array Sintaxe
@see \Gpupo\Search\Query\QueryAbstract::getQueries()         Query Array Sintaxe
@see \Gpupo\Search\Query\QueryAbstract::getFieldWeights()    Query Array Sintaxe

@param array $filter       Search filter
@param array $queries      Search query
@param array $fieldWeights Field weights array
@param int   $limit
@param int   $offset

@return array Results
Executa Queries .