Class AsyncSearchSession
An async search session tracks all incoming items found by search provider that weren't returned right away after the search was initiated.
Inheritance
Namespace: Unity.QuickSearch
Syntax
public class AsyncSearchSession
Properties
SearchInProgress
Checks if there is any active async search sessions.
Declaration
public static bool SearchInProgress { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
FetchSome(List<SearchItem>, Int32, Boolean)
Request to fetch new async search results.
Declaration
public bool FetchSome(List<SearchItem> items, int quantity, bool doNotCountNull)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<SearchItem> | items | The list of items to append new results to. |
System.Int32 | quantity | The maximum amount of items to be added to @items |
System.Boolean | doNotCountNull | Ignore all yield return null results. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if there is still some results to fetch later or false if we've fetched everything remaining. |
FetchSome(List<SearchItem>, Int32, Boolean, Int64)
Request to fetch new async search results.
Declaration
public bool FetchSome(List<SearchItem> items, int quantity, bool doNotCountNull, long maxFetchTimeMs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<SearchItem> | items | The list of items to append new results to. |
System.Int32 | quantity | The maximum amount of items to add to @items |
System.Boolean | doNotCountNull | Ignore all yield return null results. |
System.Int64 | maxFetchTimeMs | The amount of time allowed to yield new results. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if there is still some results to fetch later or false if we've fetched everything remaining. |
FetchSome(List<SearchItem>, Int64)
Request to fetch new async search results.
Declaration
public bool FetchSome(List<SearchItem> items, long maxFetchTimeMs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<SearchItem> | items | The list of items to append new results to. |
System.Int64 | maxFetchTimeMs | The amount of time allowed to yield new results. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if there is still some results to fetch later or false if we've fetched everything remaining. |
OnUpdate()
Called when the system is ready to process any new async results.
Declaration
public void OnUpdate()
Reset(IEnumerator<SearchItem>, Int64)
Hard reset an async search session.
Declaration
public void Reset(IEnumerator<SearchItem> itemEnumerator, long maxFetchTimePerProviderMs = 10L)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerator<SearchItem> | itemEnumerator | The enumerator that will yield new search results. |
System.Int64 | maxFetchTimePerProviderMs | The amount of time allowed to yield new results. |
Remarks
Normally async search sessions are re-used per search provider.
Stop()
Stop the async search session and discard any new search results.
Declaration
public void Stop()
Events
asyncItemReceived
This event is used to receive any async search result.
Declaration
public static event Action<IEnumerable<SearchItem>> asyncItemReceived
Event Type
Type | Description |
---|---|
System.Action<System.Collections.Generic.IEnumerable<SearchItem>> |
Remarks
It is usually used by a search view to append additional search results to a UI list.