diff -u b/src/Query/Query.php b/src/Query/Query.php --- b/src/Query/Query.php +++ b/src/Query/Query.php @@ -239,7 +239,7 @@ /** * {@inheritdoc} */ - public function setFulltextFields($fields = NULL) { + public function setFulltextFields(array $fields = NULL) { $fulltext_fields = $this->index->getFulltextFields(); foreach (array_diff($fields, $fulltext_fields) as $field_id) { throw new SearchApiException(SafeMarkup::format('Trying to search on field @field which is no indexed fulltext field.', array('@field' => $field_id))); @@ -319,11 +319,6 @@ if (!$this->preExecuteRan) { $this->preExecuteRan = TRUE; - // Add fulltext fields, unless set - if ($this->fields === NULL) { - $this->fields = $this->index->getFulltextFields(); - } - // Preprocess query. $this->index->preprocessSearchQuery($this); diff -u b/src/Query/QueryInterface.php b/src/Query/QueryInterface.php --- b/src/Query/QueryInterface.php +++ b/src/Query/QueryInterface.php @@ -85,7 +85,7 @@ * @throws \Drupal\search_api\SearchApiException * Thrown if one of the fields isn't a fulltext field. */ - public function setFulltextFields($fields = NULL); + public function setFulltextFields(array $fields = NULL); /** * Adds a subfilter to this query's filter. @@ -230,9 +230,9 @@ /** * Retrieves the fulltext fields that will be searched for the search keys. * - * @return NULL|string[] + * @return string[]|null * An array containing the fields that should be searched for the search - * keys or null. + * keys or NULL if the method is called before QueryInterface::preExecute(). * * @see fields() */