# SearchEngineScope

> An enumeration that contains the available search engine scopes.

## Definition

* **Type:** Enum
* **Namespace:** [UnityEditor.SearchService](/engine/6000.6/script-reference/unityeditor/searchservice.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public enum SearchEngineScope
```

## Remarks

A search engine scope identifies where a search comes from. This is useful when implementing a single entry point for the base engine functions:

## Examples

```csharp
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.SearchService;

class BaseEngine : ISearchEngineBase
{
    public virtual void BeginSession(ISearchContext context)
    {
        if (context.engineScope == ObjectSelectorSearch.EngineScope || context.engineScope == ProjectSearch.EngineScope)
        {
            // Cache Assets.
        }
        if (context.engineScope == ObjectSelectorSearch.EngineScope || context.engineScope == SceneSearch.EngineScope)
        {
            // Cache Scene objects.
        }
    }

    public virtual void EndSession(ISearchContext context)
    {
        // Flush any cached data.
    }

    public virtual void BeginSearch(ISearchContext context, string query)
    {
    }

    public virtual void EndSearch(ISearchContext context)
    {
    }

    public string name => "My Engine Service";
}

[SceneSearchEngine]
class SampleSceneFilterEngine : BaseEngine, ISceneSearchEngineV2
{
    public bool Filter(ISearchContext context, string query, HierarchyIterator objectToFilter)
    {
        // Use cached Scene objects.
        // ...
        return true;
    }
}

[ProjectSearchEngine]
class SampleProjectSearchEngine : BaseEngine, IProjectSearchEngine
{
    public IEnumerable<string> Search(ISearchContext context, string query, Action<IEnumerable<string>> asyncItemsReceived)
    {
        // Use cached Assets.
        // ...
        return new List<string>();
    }
}

[ObjectSelectorEngine]
class SampleObjectSelectorEngine : BaseEngine, IObjectSelectorEngine
{
    public bool SelectObject(ISearchContext context, Action<UnityEngine.Object, bool> onObjectSelectorClosed, Action<UnityEngine.Object> onObjectSelectedUpdated)
    {
        // Use cached Assets and Scene objects.
        return true;
    }

    public void SetSearchFilter(ISearchContext context, string searchFilter)
    {}
}
```

## Fields

| Value                                                                                                           | Description                                                                                                                                          |
| --------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| [ObjectSelector](/engine/6000.6/script-reference/unityeditor/searchservice/searchenginescope/objectselector.md) | Identifies a search for ObjectSelector engines.                                                                                                      |
| [Project](/engine/6000.6/script-reference/unityeditor/searchservice/searchenginescope/project.md)               | Identifies a search for [SearchEngineScope.Project](/engine/6000.6/script-reference/unityeditor/searchservice/searchenginescope/project.md) engines. |
| [Scene](/engine/6000.6/script-reference/unityeditor/searchservice/searchenginescope/scene.md)                   | Identifies a search for [SearchEngineScope.Scene](/engine/6000.6/script-reference/unityeditor/searchservice/searchenginescope/scene.md) engines.     |
