public function add_fields($query) {
        $documentclass = $this->get_document_classname();
        $fields = $documentclass::get_default_fields_definition();

        $dismax = false;
        if ($query instanceof \SolrDisMaxQuery) {
            $dismax = true;
        }

        foreach ($fields as $key => $field) {
            $query->addField($key);
            if ($dismax && !empty($field['mainquery'])) {
                // Add fields the main query should be run against.
                $query->addQueryField($key);
            }
        }
    }
public function add_fields($query) {
        $documentclass = $this->get_document_classname();
        $fields = $documentclass::get_default_fields_definition();

        $dismax = false;
        if ($query instanceof \SolrDisMaxQuery) {
            $dismax = true;
        }

        foreach ($fields as $key => $field) {
            $query->addField($key);
            if ($dismax && !empty($field['mainquery'])) {
                // Add fields the main query should be run against.
                $query->addQueryField($key);
            }
        }
    }
public function add_fields ( $ query ) { $ documentclass = $ this -> get_document_classname ( ) ; $ fields = $ documentclass :: get_default_fields_definition ( ) ; $ dismax = false ; if ( $ query instanceof \ SolrDisMaxQuery ) { $ dismax = true ; } foreach ( $ fields as $ key => $ field ) { $ query -> addField ( $ key ) ; if ( $ dismax && ! empty ( $ field [ 'mainquery' ] ) ) { // Add fields the main query should be run against. $ query -> addQueryField ( $ key ) ; } } }
Sets fields to be returned in the result.

@param SolrDisMaxQuery|SolrQuery $query object.
Sets fields to be returned in the result .