SearchContext
The search context includes all the data necessary to perform a query. It allows the full customization of how a query may be performed.
Read time 2 minutesLast updated 6 days ago
Definition
- Type: Class
- Namespace: UnityEditor.Search
- Assembly: UnityEditor
- Implements: IDisposable, ISerializationCallbackReceiver
public class SearchContext : IDisposable, ISerializationCallbackReceiver
Constructors
Constructor | Description |
|---|---|
| SearchContext(System.Collections.Generic.IEnumerable{UnityEditor.Search.SearchProvider}) | Creates a new search context. |
| SearchContext(System.Collections.Generic.IEnumerable{UnityEditor.Search.SearchProvider},System.String) | Creates a new search context. |
| SearchContext(System.Collections.Generic.IEnumerable{UnityEditor.Search.SearchProvider},System.String,UnityEditor.Search.SearchFlags) | Creates a new search context. |
Properties
Property | Description |
|---|---|
| empty | Indicates of the search query is empty. This exclude the search filter id. In example if the search text is |
| filterId | Explicit filter ID. Usually it is the first search token like h:, p: to do an explicit search for a given search provider. Can be null. |
| options | Search context options. |
| progressId | Progress handle to display the progress bar for the search currently in progress. |
| providers | Which search providers are active for this particular context. |
| searchInProgress | Indicates if an asynchronous search is currently in progress for this context. |
| searchPhrase | Returns a phrase that contains only words separated by spaces. |
| searchQuery | Processed search query (no filterId, no textFilters). |
| searchQueryOffset | Character offset of the processed search query in the raw search text. |
| searchText | Raw search text (what is in the Search text box). |
| searchView | The search view presenting the search results. |
| searchWords | Search query tokenized by words. All text filters are discarded and all words are in lowercase. |
| selection | Returns the search result selection if any. |
| textFilters | All tokens containing a colon (':'). |
| wantsMore | Indicates if the search should return all the results instead of only the most relevant. |
Methods
Method | Description |
|---|---|
| AddSearchQueryError | Adds a new query error on this context. |
| AddSearchQueryErrors | Adds new query errors on this context. |
| Dispose | Dispose of the Search Context. |
| IsEnabled | Checks if a search provider is available to process a query. |
| SetFilter | Enables or disables a single search provider. A disabled search provider won't be asked to provide items to resolve the query. |
Events
Member | Description |
|---|---|
| asyncItemReceived | This event is used to receive any asynchronous search result. |
| sessionEnded | Invoked when a Search has ended. |
| sessionStarted | Invoked when a Search is started. |