By kim.pepper on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.8.x
Introduced in version:
8.8.0
Issue links:
Description:
Search index related functions have been moved to a service and deprecated. See the documentation on \Drupal\search\SearchIndexInterface for details.
| Before | After |
|---|---|
search_index() |
\Drupal::service('search.index')->index() -- Note that if you are doing an indexing run with multiple calls, it will be more efficient if you pass the new last argument to ::index() $update_weights as FALSE and use the returned $words needing update, and then call ::updateWordWeights() at the end of your indexing run. |
search_index_clear() |
\Drupal::service('search.index')->clear() |
search_mark_for_reindex() |
\Drupal::service('search.index')->markForReindex() |
search_update_totals() |
Sort of replaced by \Drupal::service('search.index')->updateWordWeights($words) -- see notes about the ::index() function above, and the documentation on the SearchIndex interface. |
search_dirty() |
An internal function that was only used by search_index() and has no replacement. |
When using dependency injection, you should typehint against the \Drupal\search\SearchIndexInterface interface.
Impacts:
Module developers