Class SearchItem | Quick Search | 2.0.0
docs.unity3d.com
    Show / Hide Table of Contents

    Class SearchItem

    Search items are returned by the search provider when some results need to be shown to the user after a search is made. The search item holds all the data that will be used to sort and present the search results.

    Inheritance
    Object
    SearchItem
    Namespace: Unity.QuickSearch
    Syntax
    public class SearchItem : IEquatable<SearchItem>, IComparable<SearchItem>

    Constructors

    SearchItem(String)

    Construct a search item. Minimally a search item need to have a unique id for a given search query.

    Declaration
    public SearchItem(string _id)
    Parameters
    Type Name Description
    String _id

    Fields

    context

    Context used to create that item.

    Declaration
    public SearchContext context
    Field Value
    Type Description
    SearchContext

    data

    Search provider defined content. It can be used to transport any data to custom search provider handlers (i.e. fetchDescription).

    Declaration
    public object data
    Field Value
    Type Description
    Object

    description

    If no description is provided, SearchProvider.fetchDescription will be called when the item is first displayed.

    Declaration
    public string description
    Field Value
    Type Description
    String

    id

    Unique id of this item among this provider items.

    Declaration
    public readonly string id
    Field Value
    Type Description
    String

    label

    Display name of the item

    Declaration
    public string label
    Field Value
    Type Description
    String

    none

    A search item representing none, usually used to clear the selection.

    Declaration
    public static readonly SearchItem none
    Field Value
    Type Description
    SearchItem

    options

    Various flags that dictates how the search item is displayed and used.

    Declaration
    public SearchItemOptions options
    Field Value
    Type Description
    SearchItemOptions

    preview

    Large preview of the search item. Usually cached by fetchPreview.

    Declaration
    public Texture2D preview
    Field Value
    Type Description
    Texture2D

    provider

    Back pointer to the provider.

    Declaration
    public SearchProvider provider
    Field Value
    Type Description
    SearchProvider

    score

    The item score can affect how the item gets sorted within the same provider.

    Declaration
    public int score
    Field Value
    Type Description
    Int32

    thumbnail

    If no thumbnail are provider, SearchProvider.fetchThumbnail will be called when the item is first displayed.

    Declaration
    public Texture2D thumbnail
    Field Value
    Type Description
    Texture2D

    Methods

    Compare(SearchItem, SearchItem)

    Check if 2 SearchItems have the same id.

    Declaration
    public int Compare(SearchItem x, SearchItem y)
    Parameters
    Type Name Description
    SearchItem x
    SearchItem y
    Returns
    Type Description
    Int32

    Returns true if SearchItem have the same id.

    CompareTo(SearchItem)

    Check if 2 SearchItems have the same id.

    Declaration
    public int CompareTo(SearchItem other)
    Parameters
    Type Name Description
    SearchItem other
    Returns
    Type Description
    Int32

    Returns true if SearchItem have the same id.

    Equals(Object)

    Check if 2 SearchItems have the same id.

    Declaration
    public override bool Equals(object other)
    Parameters
    Type Name Description
    Object other
    Returns
    Type Description
    Boolean

    Returns true if SearchItem have the same id.

    Overrides
    Object.Equals(Object)

    Equals(SearchItem)

    Check if 2 SearchItems have the same id.

    Declaration
    public bool Equals(SearchItem other)
    Parameters
    Type Name Description
    SearchItem other
    Returns
    Type Description
    Boolean

    Returns true if SearchItem have the same id.

    GetDescription(SearchContext, Boolean)

    Fetch and format description

    Declaration
    public string GetDescription(SearchContext context, bool stripHTML = false)
    Parameters
    Type Name Description
    SearchContext context

    Any search context for the item provider.

    Boolean stripHTML

    True if any HTML tags should be dropped.

    Returns
    Type Description
    String

    The search item description

    GetHashCode()

    Default Hash of a SearchItem

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A hash code for the current SearchItem

    Overrides
    Object.GetHashCode()

    GetLabel(SearchContext, Boolean)

    Fetch and format label.

    Declaration
    public string GetLabel(SearchContext context, bool stripHTML = false)
    Parameters
    Type Name Description
    SearchContext context

    Any search context for the item provider.

    Boolean stripHTML

    True if any HTML tags should be dropped.

    Returns
    Type Description
    String

    The search item label

    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