original_string: 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);
              }
          }
      }
code: 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);
              }
          }
      }
code_tokens: 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 ) ; } } }
docstring: Sets fields to be returned in the result.
  
  @param SolrDisMaxQuery|SolrQuery $query object.
docstring_tokens: Sets fields to be returned in the result .