Function Fast_custom_index->index_for_search__lang__appearance_context
Definitions
sources/database_search.php
- Index a content resource, specifically for a particular language and appearance context.
- Visibility: protected
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: array
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $db | object | No | No | required parameter | N/A | N/A | Database connection |
| $lang | LANGUAGE_NAME | No | No | required parameter | N/A | N/A | Language codename |
| $index_table | string | No | No | required parameter | N/A | N/A | Table containing our custom index |
| $content_fields | array | No | No | required parameter | N/A | N/A | Map of content fields, field name to data (may contain fake fields) |
| $appearance_context | integer | No | No | required parameter | N/A | N/A | An APPEARANCE_CONTEXT_* constant |
| $fields_to_index | array | No | No | required parameter | N/A | N/A | List of field names from $content_fields that should be indexed for ngram tokens |
| $key_map | array | No | No | required parameter | N/A | N/A | A map of keys for the index |
| $filter_field_transfer_map | array | No | No | required parameter | N/A | N/A | A map between content field keys to index field keys, so we can fill out some of the filtering that goes inside the index |
| $ngrams_exclude | ?array | No | No | required parameter | N/A | N/A | A list of ngrams to explicitly exclude (used internally to stop repetitions across multiple APPEARANCE_CONTEXTs, ultimately required to stop row repetition in output) (null: none) |
| &$total_singular_ngram_tokens | ?integer | Yes | No | Null | N/A | N/A | Maintain a count of singular ngrams (typically words) in here (null: do not maintain) |
| &$statistics_map | ?array | Yes | No | Null | N/A | N/A | Write into this map of singular ngram (typically, words) to number of occurrences (null: do not maintain a map) |
Returns
- Map between ngrams and number of occurrences
- Type: array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Index a content resource, specifically for a particular language and appearance context.
*
* @param object $db Database connection
* @param LANGUAGE_NAME $lang Language codename
* @param string $index_table Table containing our custom index
* @param array $content_fields Map of content fields, field name to data (may contain fake fields)
* @param integer $appearance_context An APPEARANCE_CONTEXT_* constant
* @param array $fields_to_index List of field names from $content_fields that should be indexed for ngram tokens
* @param array $key_map A map of keys for the index
* @param array $filter_field_transfer_map A map between content field keys to index field keys, so we can fill out some of the filtering that goes inside the index
* @param ?array $ngrams_exclude A list of ngrams to explicitly exclude (used internally to stop repetitions across multiple APPEARANCE_CONTEXTs, ultimately required to stop row repetition in output) (null: none)
* @param ?integer $total_singular_ngram_tokens Maintain a count of singular ngrams (typically words) in here (null: do not maintain)
* @param ?array $statistics_map Write into this map of singular ngram (typically, words) to number of occurrences (null: do not maintain a map)
* @return array Map between ngrams and number of occurrences
*/
protected function index_for_search__lang__appearance_context(object $db, string $lang, string $index_table, array $content_fields, int $appearance_context, array $fields_to_index, array $key_map, array $filter_field_transfer_map, ?array $ngrams_exclude, ?int &$total_singular_ngram_tokens = null, ?array &$statistics_map = null) : array
* Index a content resource, specifically for a particular language and appearance context.
*
* @param object $db Database connection
* @param LANGUAGE_NAME $lang Language codename
* @param string $index_table Table containing our custom index
* @param array $content_fields Map of content fields, field name to data (may contain fake fields)
* @param integer $appearance_context An APPEARANCE_CONTEXT_* constant
* @param array $fields_to_index List of field names from $content_fields that should be indexed for ngram tokens
* @param array $key_map A map of keys for the index
* @param array $filter_field_transfer_map A map between content field keys to index field keys, so we can fill out some of the filtering that goes inside the index
* @param ?array $ngrams_exclude A list of ngrams to explicitly exclude (used internally to stop repetitions across multiple APPEARANCE_CONTEXTs, ultimately required to stop row repetition in output) (null: none)
* @param ?integer $total_singular_ngram_tokens Maintain a count of singular ngrams (typically words) in here (null: do not maintain)
* @param ?array $statistics_map Write into this map of singular ngram (typically, words) to number of occurrences (null: do not maintain a map)
* @return array Map between ngrams and number of occurrences
*/
protected function index_for_search__lang__appearance_context(object $db, string $lang, string $index_table, array $content_fields, int $appearance_context, array $fields_to_index, array $key_map, array $filter_field_transfer_map, ?array $ngrams_exclude, ?int &$total_singular_ngram_tokens = null, ?array &$statistics_map = null) : array
