"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.9/core/modules/search/src/SearchIndexInterface.php" (18 Nov 2020, 3737 Bytes) of package /linux/www/drupal-8.9.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "SearchIndexInterface.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\search;
    4 
    5 /**
    6  * Provides search index management functions.
    7  *
    8  * @ingroup search
    9  */
   10 interface SearchIndexInterface {
   11 
   12   /**
   13    * Updates the full-text search index for a particular item.
   14    *
   15    * @param string $type
   16    *   The plugin ID or other machine-readable type of this item,
   17    *   which should be less than 64 bytes.
   18    * @param int $sid
   19    *   An ID number identifying this particular item (e.g., node ID).
   20    * @param string $langcode
   21    *   Language code for the language of the text being indexed.
   22    * @param string $text
   23    *   The content of this item. Must be a piece of HTML or plain text.
   24    * @param bool $update_weights
   25    *   (optional) TRUE if word weights should be updated. FALSE otherwise;
   26    *   defaults to TRUE. If you pass in FALSE, then you need to have your
   27    *   calls to this method in a try/finally block, and at the end of your
   28    *   index run in the finally clause, you will need to call
   29    *   self::updateWordWeights(), passing in all of the returned words, to
   30    *   update the word weights.
   31    *
   32    * @return string[]
   33    *   The words to be updated.
   34    *
   35    * @throws \Drupal\search\Exception\SearchIndexException
   36    *   If there is an error indexing the text.
   37    */
   38   public function index($type, $sid, $langcode, $text, $update_weights = TRUE);
   39 
   40   /**
   41    * Clears either a part of, or the entire search index.
   42    *
   43    * This function is meant for use by search page plugins, or for building a
   44    * user interface that lets users clear all or parts of the search index.
   45    *
   46    * @param string|null $type
   47    *   (optional) The plugin ID or other machine-readable type for the items to
   48    *   remove from the search index. If omitted, $sid and $langcode are ignored
   49    *   and the entire search index is cleared.
   50    * @param int|array|null $sid
   51    *   (optional) The ID or array of IDs of the items to remove from the search
   52    *   index. If omitted, all items matching $type are cleared, and $langcode
   53    *   is ignored.
   54    * @param string|null $langcode
   55    *   (optional) Language code of the item to remove from the search index. If
   56    *   omitted, all items matching $sid and $type are cleared.
   57    *
   58    * @throws \Drupal\search\Exception\SearchIndexException
   59    *   If there is an error clearing the index.
   60    */
   61   public function clear($type = NULL, $sid = NULL, $langcode = NULL);
   62 
   63   /**
   64    * Changes the timestamp on indexed items to 'now' to force reindexing.
   65    *
   66    * This function is meant for use by search page plugins, or for building a
   67    * user interface that lets users mark all or parts of the search index for
   68    * reindexing.
   69    *
   70    * @param string $type
   71    *   (optional) The plugin ID or other machine-readable type of this item. If
   72    *   omitted, the entire search index is marked for reindexing, and $sid and
   73    *   $langcode are ignored.
   74    * @param int $sid
   75    *   (optional) An ID number identifying this particular item (e.g., node ID).
   76    *   If omitted, everything matching $type is marked, and $langcode is
   77    *   ignored.
   78    * @param string $langcode
   79    *   (optional) The language code to mark. If omitted, everything matching
   80    *   $type and $sid is marked.
   81    *
   82    * @throws \Drupal\search\Exception\SearchIndexException
   83    *   If there is an error marking the index for re-indexing.
   84    */
   85   public function markForReindex($type = NULL, $sid = NULL, $langcode = NULL);
   86 
   87   /**
   88    * Updates the {search_total} database table.
   89    *
   90    * @param array $words
   91    *   An array whose keys are words from self::index() whose total weights
   92    *   need to be updated.
   93    *
   94    * @throws \Drupal\search\Exception\SearchIndexException
   95    *   If there is an error updating the totals.
   96    */
   97   public function updateWordWeights(array $words);
   98 
   99 }