SearchSpec

public final class SearchSpec
extends Object

java.lang.Object
   ↳ androidx.appsearch.app.SearchSpec


This class represents the specification logic for AppSearch. It can be used to set the type of search, like prefix or exact only or apply filters to search for a specific schema type only etc.

Summary

Nested classes

class SearchSpec.Builder

Builder for objects

Constants

int GROUPING_TYPE_PER_NAMESPACE

Results should be grouped together by namespace for the purpose of enforcing a limit on the number of results returned per namespace.

int GROUPING_TYPE_PER_PACKAGE

Results should be grouped together by package for the purpose of enforcing a limit on the number of results returned per package.

int ORDER_ASCENDING

Search results will be returned in an ascending order.

int ORDER_DESCENDING

Search results will be returned in a descending order.

String PROJECTION_SCHEMA_TYPE_WILDCARD

Schema type to be used in SearchSpec.Builder.addProjection(String, Collection) to apply property paths to all results, excepting any types that have had their own, specific property paths set.

int RANKING_STRATEGY_CREATION_TIMESTAMP

Ranked by document creation timestamps.

int RANKING_STRATEGY_DOCUMENT_SCORE

Ranked by app-provided document scores.

int RANKING_STRATEGY_NONE

No Ranking, results are returned in arbitrary order.

int RANKING_STRATEGY_RELEVANCE_SCORE

Ranked by document relevance score.

int RANKING_STRATEGY_SYSTEM_USAGE_COUNT

Ranked by number of usages from a system UI surface.

int RANKING_STRATEGY_SYSTEM_USAGE_LAST_USED_TIMESTAMP

Ranked by timestamp of last usage from a system UI surface.

int RANKING_STRATEGY_USAGE_COUNT

Ranked by number of usages, as reported by the app.

int RANKING_STRATEGY_USAGE_LAST_USED_TIMESTAMP

Ranked by timestamp of last usage, as reported by the app.

int TERM_MATCH_EXACT_ONLY

Query terms will only match exact tokens in the index.

int TERM_MATCH_PREFIX

Query terms will match indexed tokens when the query term is a prefix of the token.

Public methods

List<String> getFilterNamespaces()

Returns the list of namespaces to search over.

List<String> getFilterPackageNames()

Returns the list of package name filters to search over.