# IndexWord

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

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.Search](/engine/6000.7/script-reference/unityeditor/search.md)
* **Assembly:** UnityEditor

## IndexWord(int, string, int, bool, int)

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

> **Warning:**
>
> **Deprecated.** IndexWord with variations and exact match is no longer supported. Variations are handled internally. Exact match is handled when filtering. Use IndexWord(int documentIndex, string word, int scoreModifier) instead.

```csharp
public void IndexWord(int documentIndex, in string word, int maxVariations, bool exact, int scoreModifier = 0)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Document where the indexed word was found.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Word to add to the index.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): **Maximum number of variations to compute. Cannot be higher than the length of the word.****** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): If true, the indexer will also store an exact match entry for this word.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Modifier to apply to the base match score for a specific word.

## IndexWord(int, string, bool, int)

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

> **Warning:**
>
> **Deprecated.** IndexWord with exact match is no longer supported. Exact match is handled when filtering. Use IndexWord(int documentIndex, string word, int scoreModifier) instead.

```csharp
public void IndexWord(int documentIndex, in string word, bool exact = false, int scoreModifier = 0)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Document where the indexed word was found.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Word to add to the index.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): If true, we will also store an exact match entry for this word.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Modifier to apply to the base match score for a specific word.

### Remarks

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

## IndexWord(int, string)

Adds a new word coming from a specific document to the index.

```csharp
public void IndexWord(int documentIndex, string word)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Document where the indexed word was found.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Word to add to the index.

### Remarks

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

### Examples

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

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

## IndexWord(int, string, int)

Adds a new word coming from a specific document to the index.

```csharp
public void IndexWord(int documentIndex, string word, int scoreModifier)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Document where the indexed word was found.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Word to add to the index.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Modifier to apply to the base match score for a specific word.

### Remarks

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

### Examples

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

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