Added in API level 34

SearchSuggestionSpec


class SearchSuggestionSpec : Parcelable
kotlin.Any
   ↳ android.app.appsearch.SearchSuggestionSpec

This class represents the specification logic for AppSearch. It can be used to set the filter and settings of search a suggestions.

Summary

Nested classes

Builder for objects.

Constants
static Int

Ranked by the document count that contains the term.

static Int

No Ranking, results are returned in arbitrary order.

static Int

Ranked by the term appear frequency.

Inherited constants
Public methods
MutableMap<String!, MutableList<String!>!>

Returns the map of namespace and target document ids to search over.

MutableList<String!>

Returns the list of namespaces to search over.

MutableMap<String!, MutableList<String!>!>

Returns the map of schema and target properties to search over.

MutableList<String!>

Returns the list of schema to search the suggestion over.

Int

Returns the maximum number of wanted suggestion that will be returned in the result object.

Int

Returns the ranking strategy.

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<SearchSuggestionSpec!>

Constants

SUGGESTION_RANKING_STRATEGY_DOCUMENT_COUNT

Added in API level 34
static val SUGGESTION_RANKING_STRATEGY_DOCUMENT_COUNT: Int

Ranked by the document count that contains the term.

Suppose the following document is in the index.

Doc1 contains: term1 term2 term2 term2
Doc2 contains: term1

Then, suppose that a search suggestion for "t" is issued with the DOCUMENT_COUNT, the returned SearchSuggestionResults will be: term1, term2. The term1 will have higher score and appear in the results first.

Value: 0

SUGGESTION_RANKING_STRATEGY_NONE

Added in API level 34
static val SUGGESTION_RANKING_STRATEGY_NONE: Int

No Ranking, results are returned in arbitrary order.

Value: 2

SUGGESTION_RANKING_STRATEGY_TERM_FREQUENCY

Added in API level 34
static val SUGGESTION_RANKING_STRATEGY_TERM_FREQUENCY: Int

Ranked by the term appear frequency.

Suppose the following document is in the index.

Doc1 contains: term1 term2 term2 term2
Doc2 contains: term1

Then, suppose that a search suggestion for "t" is issued with the TERM_FREQUENCY, the returned SearchSuggestionResults will be: term2, term1. The term2 will have higher score and appear in the results first.

Value: 1

Public methods

getFilterDocumentIds

Added in API level 34
fun getFilterDocumentIds(): MutableMap<String!, MutableList<String!>!>

Returns the map of namespace and target document ids to search over.

The keys of the returned map are namespaces, and the values are the target document ids in that namespace to search over.

If android.app.appsearch.SearchSuggestionSpec.Builder#addFilterDocumentIds was never called, returns an empty map. In this case AppSearch will search over all namespace and document ids.

Calling this function repeatedly is inefficient. Prefer to retain the Map returned by this function, rather than calling it multiple times.

Return
MutableMap<String!, MutableList<String!>!> This value cannot be null.

getFilterNamespaces

Added in API level 34
fun getFilterNamespaces(): MutableList<String!>

Returns the list of namespaces to search over.

If empty, will search over all namespaces.

Return
MutableList<String!> This value cannot be null.

getFilterProperties

Added in API level 35
fun getFilterProperties(): MutableMap<String!, MutableList<String!>!>

Returns the map of schema and target properties to search over.

The keys of the returned map are schema types, and the values are the target property path in that schema to search over.

If Builder#addFilterPropertyPaths was never called, returns an empty map. In this case AppSearch will search over all schemas and properties.

Calling this function repeatedly is inefficient. Prefer to retain the Map returned by this function, rather than calling it multiple times.

Return
MutableMap<String!, MutableList<String!>!> This value cannot be null.

getFilterSchemas

Added in API level 34
fun getFilterSchemas(): MutableList<String!>

Returns the list of schema to search the suggestion over.

If empty, will search over all schemas.

Return
MutableList<String!> This value cannot be null.

getMaximumResultCount

Added in API level 34
fun getMaximumResultCount(): Int

Returns the maximum number of wanted suggestion that will be returned in the result object.

writeToParcel

Added in API level 35
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 35
static val CREATOR: Parcelable.Creator<SearchSuggestionSpec!>