Version: 2022.3
LanguageEnglish
  • C#

ObjectIndexer.IndexWord

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void IndexWord(int documentIndex, ref string word, bool exact, int scoreModifier);

Parameters

documentIndex Document where the indexed word was found.
word Word to add to the index.
exact If true, we will also store an exact match entry for this word.
scoreModifier Modified to apply to the base match score for a specific word.

Description

Adds a new word coming from a specific document to the index. The word will be added with multiple variations allowing partial search.

The following example indexes a word that can be used to search indexed prefabs with myawesomeword, myawe, etc.

[CustomObjectIndexer(typeof(GameObject))]
static void IndexGameObject(CustomObjectIndexerTarget target, ObjectIndexer indexer)
{
    var go = target.target as GameObject;
    if (go == null)
        return;

    indexer.AddWord("myawesomeword", 0, target.documentIndex);
}

Declaration

public void IndexWord(int documentIndex, ref string word, int maxVariations, bool exact, int scoreModifier);

Parameters

documentIndex Document where the indexed word was found.
word Word to add to the index.
maxVariations Maximum number of variations to compute. Cannot be higher than the length of the word.
exact If true, the indexer will also store an exact match entry for this word.
scoreModifier Modified to apply to the base match score for a specific word.

Description

The word will be added with a maximum of variation. This can be used to save some space for very large words.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961