You are here

public function Query::getSearchId in Search API 8

Retrieves the search ID.

Parameters

bool $generate: (optional) If TRUE and no search ID was set yet for this query, generate one automatically. If FALSE, NULL will be returned in this case.

Return value

string|null The search ID, or NULL if none was set yet and $generate is FALSE.

Overrides QueryInterface::getSearchId

File

src/Query/Query.php, line 351

Class

Query
Provides a standard implementation for a Search API query.

Namespace

Drupal\search_api\Query

Code

public function getSearchId($generate = TRUE) {
  if ($generate && !isset($this->searchId)) {
    static $num = 0;
    $this->searchId = 'search_' . ++$num;
  }
  return $this->searchId;
}