Class SearchService | Quick Search | 1.5.4
docs.unity3d.com
    Show / Hide Table of Contents

    Class SearchService

    Principal Quick Search API to initiate searches and fetch results.

    Inheritance
    Object
    SearchService
    Namespace: Unity.QuickSearch
    Syntax
    public static class SearchService

    Properties

    Filter

    Returns the current search filter being applied.

    Declaration
    public static SearchFilter Filter { get; }
    Property Value
    Type Description
    SearchFilter

    OrderedProviders

    Returns the list of providers sorted by priority.

    Declaration
    public static IEnumerable<SearchProvider> OrderedProviders { get; }
    Property Value
    Type Description
    IEnumerable<SearchProvider>

    Providers

    Returns the list of all providers (active or not)

    Declaration
    public static List<SearchProvider> Providers { get; }
    Property Value
    Type Description
    List<SearchProvider>

    Methods

    Disable(SearchContext)

    Indicates that a search session should be terminated.

    Declaration
    public static void Disable(SearchContext context)
    Parameters
    Type Name Description
    SearchContext context

    The search context ending the search session.

    Remarks

    Any asynchronously running search query will be stopped and all search result will be lost.

    Enable(SearchContext)

    Setup the search service before initiating a search session. A search session can be composed of many searches (different words, etc.)

    Declaration
    public static void Enable(SearchContext context)
    Parameters
    Type Name Description
    SearchContext context

    The search context to be initialized.

    GetAction(SearchProvider, String)

    Returns the search action data for a given provider and search action id.

    Declaration
    public static SearchAction GetAction(SearchProvider provider, string actionId)
    Parameters
    Type Name Description
    SearchProvider provider

    Provider to lookup

    String actionId

    Unique action ID within the provider.

    Returns
    Type Description
    SearchAction

    The matching action

    GetItems(SearchContext)

    Initiate a search and return all search items matching the search context. Other items can be found later using the asynchronous searches.

    Declaration
    public static List<SearchItem> GetItems(SearchContext context)
    Parameters
    Type Name Description
    SearchContext context

    The current search context

    Returns
    Type Description
    List<SearchItem>

    A list of search items matching the search query.

    GetKeywords(SearchContext, String)

    Returns a list of keywords used by auto-completion for the active providers.

    Declaration
    public static string[] GetKeywords(SearchContext context, string lastToken)
    Parameters
    Type Name Description
    SearchContext context

    Current search context

    String lastToken

    Search token currently being typed.

    Returns
    Type Description
    String[]

    A list of keywords that can be shown in an auto-complete dropdown.

    GetProvider(String)

    Returns the data of a search provider given its ID.

    Declaration
    public static SearchProvider GetProvider(string providerId)
    Parameters
    Type Name Description
    String providerId

    Unique ID of the provider

    Returns
    Type Description
    SearchProvider

    The matching provider

    IsRecent(String)

    Checks if a search item has been used recently.

    Declaration
    public static bool IsRecent(string id)
    Parameters
    Type Name Description
    String id

    Unique ID of the search item.

    Returns
    Type Description
    Boolean

    True if the item was used recently or false otherwise.

    LoadFilters()

    Load user default filters.

    Declaration
    public static bool LoadFilters()
    Returns
    Type Description
    Boolean

    True if filters were properly loaded, otherwise false is returned.

    Refresh()

    Clears everything and reloads all search providers.

    Declaration
    public static void Refresh()
    Remarks

    Use with care. Useful for unit tests.

    SetRecent(SearchItem)

    Sets the last activated search item.

    Declaration
    public static void SetRecent(SearchItem item)
    Parameters
    Type Name Description
    SearchItem item

    The item to be marked as been used recently.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023