# GetDocument(int)

> Returns a search document by its index.

## Definition

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

```csharp
public SearchDocument GetDocument(int index)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Valid index of the document to access.

### Returns

| Type                                                                                   | Description              |
| -------------------------------------------------------------------------------------- | ------------------------ |
| [SearchDocument](/engine/6000.7/script-reference/unityeditor/search/searchdocument.md) | Indexed search document. |

### Examples

```csharp
using UnityEditor;
using UnityEditor.Search;
using UnityEngine;

static class Example_SearchIndexer_GetDocument
{
    [MenuItem("Examples/SearchIndexer/GetDocument")]
    public static void Run()
    {
        var si = new SearchIndexer("SearchIndexerExample", FileUtil.GetUniqueTempPathInProject());
        si.Start();
        si.AddDocument("document 1");
        si.AddDocument("document 2");
        si.AddDocument("document 3");
        si.Finish(() =>
        {
            // Enumerate all documents
            for (int di = 0; di < si.documentCount; ++di)
            {
                var doc = si.GetDocument(di);
                Debug.Assert(doc.id.StartsWith("document"));
                Debug.Log(doc.id);
            }

            // Dispose of the SearchIndexer when you are done with it.
            si.Dispose();
        });
    }
}
```
