Mmanos\Search\Query::get PHP Method

get() public method

Execute the current query and return the results.
public get ( ) : array
return array
    public function get()
    {
        $options = array();
        if ($this->columns) {
            $options['columns'] = $this->columns;
        }
        if ($this->limit) {
            $options['limit'] = $this->limit;
            $options['offset'] = $this->offset;
        }
        $this->executeCallbacks();
        $results = $this->index->runQuery($this->query, $options);
        if ($this->columns && !in_array('*', $this->columns)) {
            $new_results = array();
            foreach ($results as $result) {
                $new_result = array();
                foreach ($this->columns as $field) {
                    if (array_key_exists($field, $result)) {
                        $new_result[$field] = $result[$field];
                    }
                }
                $new_results[] = $new_result;
            }
            $results = $new_results;
        }
        return $results;
    }