Function Fast_custom_index->index_for_search

Definitions

sources/database_search.php

  • Index a content resource.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$db object No No required parameter N/A N/A Database connection
$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)
$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_transfer_map array No No required parameter N/A N/A A map between content field keys to index field keys, so we can clear out old indexing for the content resource
$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
&$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)
$lang ?LANGUAGE_NAME No No Null N/A N/A Passed content is for this specific language only (null: lookup for all installed languages)
$clean_scan boolean No No False N/A N/A If we are doing a clean scan and hence do not need to clean up old records

Preview

Code (PHP)

/**
 * Index a content resource.
 *
 * @param  object $db Database connection
 * @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  array $fields_to_index List of field names from $content_fields that should be indexed for ngram tokens
 * @param  array $key_transfer_map A map between content field keys to index field keys, so we can clear out old indexing for the content resource
 * @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  ?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)
 * @param  ?LANGUAGE_NAME $lang Passed content is for this specific language only (null: lookup for all installed languages)
 * @param  boolean $clean_scan If we are doing a clean scan and hence do not need to clean up old records
 */

public function index_for_search(object $db, string $index_table, array $content_fields, array $fields_to_index, array $key_transfer_map, array $filter_field_transfer_map, ?int &$total_singular_ngram_tokens = null, ?array &$statistics_map = null, ?string $lang = null, bool $clean_scan = false)