Version: 2022.2
LanguageEnglish
  • C#

SearchContext

class in UnityEditor.Search


Implements interfaces:ISerializationCallbackReceiver

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

Description

The search context includes all the data necessary to perform a query. It allows the full customization of how a query may be performed.

Properties

emptyIndicates of the search query is empty. This exclude the search filter id. In example if the search text is h: , then this property will still return true.
filterIdExplicit 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.
focusedWindowEditor window that initiated the search.
optionsSearch context options.
progressIdProgress handle to display the progress bar for the search currently in progress.
providersWhich search providers are active for this particular context.
searchInProgressIndicates if an asynchronous search is currently in progress for this context.
searchPhraseReturns a phrase that contains only words separated by spaces.
searchQueryProcessed search query (no filterId, no textFilters).
searchQueryOffsetCharacter offset of the processed search query in the raw search text.
searchTextRaw search text (what is in the Search text box).
searchViewThe search view presenting the search results.
searchWordsSearch query tokenized by words. All text filters are discarded and all words are in lowercase.
selectionReturns the search result selection if any.
textFiltersAll tokens containing a colon (':').
wantsMoreIndicates if the search should return all the results instead of only the most relevant.

Constructors

SearchContextCreates a new search context.

Public Methods

AddSearchQueryErrorAdds a new query error on this context.
AddSearchQueryErrorsAdds new query errors on this context.
DisposeDispose of the Search Context.
IsEnabledChecks if a search provider is available to process a query.
SetFilterEnables or disables a single search provider. A disabled search provider won't be asked to provide items to resolve the query.

Events

asyncItemReceivedThis event is used to receive any asynchronous search result.
sessionEndedInvoked when a Search has ended.
sessionStartedInvoked when a Search is started.