You are here

public function SearchApiServiceInterface::indexItems in Search API 7

Indexes the specified items.

Parameters

SearchApiIndex $index: The search index for which items should be indexed.

array $items: An array of items to be indexed, keyed by their id. The values are associative arrays of the fields to be stored, where each field is an array with the following keys:

  • type: One of the data types recognized by the Search API, or the special type "tokens" for fulltext fields.
  • original_type: The original type of the property, as defined by the datasource controller for the index's item type.
  • value: The value to index.

The special field "search_api_language" contains the item's language and should always be indexed.

The value of fields with the "tokens" type is an array of tokens. Each token is an array containing the following keys:

  • value: The word that the token represents.
  • score: A score for the importance of that word.

Return value

array An array of the ids of all items that were successfully indexed.

Throws

SearchApiException If indexing was prevented by a fundamental configuration error.

2 methods override SearchApiServiceInterface::indexItems()
SearchApiDummyService::indexItems in tests/search_api_test_2.module
Indexes the specified items.
SearchApiTestService::indexItems in tests/search_api_test.module
Implements SearchApiServiceInterface::indexItems().

File

includes/service.inc, line 220
Contains SearchApiServiceInterface and SearchApiAbstractService.

Class

SearchApiServiceInterface
Interface defining the methods search services have to implement.

Code

public function indexItems(SearchApiIndex $index, array $items);