Features
interface Features
A class that encapsulates all features that are only supported in certain cases (e.g. only on certain implementations or only at a certain Android API Level).
Features do not depend on any runtime state, and features will never be removed. Once isFeatureSupported returns true for a certain feature, it is safe to assume that the feature will be available forever on that AppSearch storage implementation, at that Android API level, on that device.
Summary
Public functions |
|
|---|---|
Int |
Returns the maximum amount of properties that can be indexed in a Document given the Android API level and AppSearch backend. |
Boolean |
isFeatureSupported(feature: String)Returns whether a feature is supported at run-time. |
Constants
ADD_PERMISSIONS_AND_GET_VISIBILITY
const val ADD_PERMISSIONS_AND_GET_VISIBILITY = "ADD_PERMISSIONS_AND_GET_VISIBILITY": String!
Feature for isFeatureSupported. This feature covers addRequiredPermissionsForSchemaTypeVisibility, clearRequiredPermissionsForSchemaTypeVisibility, getSchemaTypesNotDisplayedBySystem, getSchemaTypesVisibleToPackages, getRequiredPermissionsForSchemaTypeVisibility, addRequiredPermissionsForSchemaTypeVisibility and clearRequiredPermissionsForSchemaTypeVisibility
ENTERPRISE_GLOBAL_SEARCH_SESSION
const val ENTERPRISE_GLOBAL_SEARCH_SESSION = "ENTERPRISE_GLOBAL_SEARCH_SESSION": String!
Feature for isFeatureSupported. This feature covers EnterpriseGlobalSearchSession
GLOBAL_SEARCH_SESSION_GET_BY_ID
const val GLOBAL_SEARCH_SESSION_GET_BY_ID = "GLOBAL_SEARCH_SESSION_GET_BY_ID": String!
Feature for isFeatureSupported. This feature covers getByDocumentIdAsync.
GLOBAL_SEARCH_SESSION_GET_SCHEMA
const val GLOBAL_SEARCH_SESSION_GET_SCHEMA = "GLOBAL_SEARCH_SESSION_GET_SCHEMA": String!
Feature for isFeatureSupported. This feature covers getSchemaAsync.
GLOBAL_SEARCH_SESSION_REGISTER_OBSERVER_CALLBACK
const val GLOBAL_SEARCH_SESSION_REGISTER_OBSERVER_CALLBACK = "GLOBAL_SEARCH_SESSION_REGISTER_OBSERVER_CALLBACK": String!
Feature for isFeatureSupported. This feature covers registerObserverCallback and unregisterObserverCallback.
INDEXER_MOBILE_APPLICATIONS
@ExperimentalAppSearchApi
const val INDEXER_MOBILE_APPLICATIONS = "INDEXER_MOBILE_APPLICATIONS": String!
Feature for isFeatureSupported. This feature indicates whether or not the MobileApplication corpus is being indexed.
This corpus contains documents representing applications installed on the device, and each document includes an icon uri, a package id, a display name, and nicknames of the app. This corpus may be queried by applications interested in querying for and launching applications, such as a search app. androidx.appsearch.builtintypes.MobileApplication can be used to parse documents returned from this corpus.
This corpus can be queried with a GlobalSearchSession, by filtering on the "android" package and the "apps" namespace, for example:
globalSession.query("",
new SearchSpec.Builder().addFilterPackageNames("android").addFilterNamespace("apps").build())
| See also | |
|---|---|
MobileApplication |
JOIN_SPEC_AND_QUALIFIED_ID
const val JOIN_SPEC_AND_QUALIFIED_ID = "JOIN_SPEC_AND_QUALIFIED_ID": String!
Feature for isFeatureSupported. This feature covers JOINABLE_VALUE_TYPE_QUALIFIED_ID, setJoinSpec, and all other join features.
LIST_FILTER_HAS_PROPERTY_FUNCTION
const val LIST_FILTER_HAS_PROPERTY_FUNCTION = "LIST_FILTER_HAS_PROPERTY_FUNCTION": String!
Feature for isFeatureSupported. This feature covers the use of the "hasProperty" function in query expressions.
For details on the "hasProperty" function in the query language, see search.
LIST_FILTER_MATCH_SCORE_EXPRESSION_FUNCTION
@ExperimentalAppSearchApi
const val LIST_FILTER_MATCH_SCORE_EXPRESSION_FUNCTION = "LIST_FILTER_MATCH_SCORE_EXPRESSION_FUNCTION": String!
Feature for isFeatureSupported. This feature covers the use of the "matchScoreExpression" function in query expressions.
For details on the "matchScoreExpression" function in the query language, see search.
LIST_FILTER_QUERY_LANGUAGE
const val LIST_FILTER_QUERY_LANGUAGE = "LIST_FILTER_QUERY_LANGUAGE": String!
Feature for isFeatureSupported. This feature covers the expansion of the query language to conform to the definition of the list filters language (https://aip.dev/160).
For more details, see search.
NUMERIC_SEARCH
const val NUMERIC_SEARCH = "NUMERIC_SEARCH": String!
Feature for isFeatureSupported. This feature covers INDEXING_TYPE_RANGE and all other numeric search features.
For details on the numeric search expressions in the query language, see search.
SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES
const val SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES = "SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES": String!
Feature for isFeatureSupported. This feature covers addIndexableNestedProperties
SCHEMA_ADD_PARENT_TYPE
const val SCHEMA_ADD_PARENT_TYPE = "SCHEMA_ADD_PARENT_TYPE": String!
Feature for isFeatureSupported. This feature covers addParentType.
SCHEMA_EMBEDDING_PROPERTY_CONFIG
const val SCHEMA_EMBEDDING_PROPERTY_CONFIG = "SCHEMA_EMBEDDING_PROPERTY_CONFIG": String!
Feature for isFeatureSupported. This feature covers AppSearchSchema.EmbeddingPropertyConfig.
For details on the embedding search expressions, see search for the query language and setRankingStrategy for the ranking language.
SCHEMA_EMBEDDING_QUANTIZATION
@ExperimentalAppSearchApi
const val SCHEMA_EMBEDDING_QUANTIZATION = "SCHEMA_EMBEDDING_QUANTIZATION": String!
Feature for isFeatureSupported. This feature covers setQuantizationType.
SCHEMA_SCORABLE_PROPERTY_CONFIG
@ExperimentalAppSearchApi
const val SCHEMA_SCORABLE_PROPERTY_CONFIG = "SCHEMA_SCORABLE_PROPERTY_CONFIG": String!
Feature for isFeatureSupported. This feature covers setScoringEnabled, setScoringEnabled, setScoringEnabled. setScorablePropertyRankingEnabled.
SCHEMA_SET_DESCRIPTION
@ExperimentalAppSearchApi
const val SCHEMA_SET_DESCRIPTION = "SCHEMA_SET_DESCRIPTION": String!
Feature for isFeatureSupported. This feature covers whether or not the AppSearch backend can store the descriptions returned by getDescription and getDescription.
SEARCH_AND_CLICK_ACCUMULATOR
@ExperimentalAppSearchApi
const val SEARCH_AND_CLICK_ACCUMULATOR = "SEARCH_AND_CLICK_ACCUMULATOR": String!
Feature for isFeatureSupported. This feature covers create.
SEARCH_EMBEDDING_MATCH_INFO
@ExperimentalAppSearchApi
const val SEARCH_EMBEDDING_MATCH_INFO = "SEARCH_EMBEDDING_MATCH_INFO": String!
Feature for isFeatureSupported. This feature covers setRetrieveEmbeddingMatchInfos.
SEARCH_RESULT_MATCH_INFO_SUBMATCH
const val SEARCH_RESULT_MATCH_INFO_SUBMATCH = "SEARCH_RESULT_MATCH_INFO_SUBMATCH": String!
Feature for isFeatureSupported. This feature covers getSubmatchRange and getSubmatch.
SEARCH_RESULT_PARENT_TYPES
@ExperimentalAppSearchApi
const val SEARCH_RESULT_PARENT_TYPES = "SEARCH_RESULT_PARENT_TYPES": String!
Feature for isFeatureSupported. This feature covers whether to wrap the parent types of a document in the corresponding androidx.appsearch.app.SearchResult, instead of in androidx.appsearch.app.GenericDocument.
SEARCH_SPEC_ADD_FILTER_DOCUMENT_IDS
@ExperimentalAppSearchApi
const val SEARCH_SPEC_ADD_FILTER_DOCUMENT_IDS = "SEARCH_SPEC_ADD_FILTER_DOCUMENT_IDS": String!
Feature for isFeatureSupported. This feature covers addFilterDocumentIds.
SEARCH_SPEC_ADD_FILTER_PROPERTIES
const val SEARCH_SPEC_ADD_FILTER_PROPERTIES = "SEARCH_SPEC_ADD_FILTER_PROPERTIES": String!
Feature for isFeatureSupported. This feature covers addFilterProperties and addFilterProperties.
SEARCH_SPEC_ADD_INFORMATIONAL_RANKING_EXPRESSIONS
const val SEARCH_SPEC_ADD_INFORMATIONAL_RANKING_EXPRESSIONS = "SEARCH_SPEC_ADD_INFORMATIONAL_RANKING_EXPRESSIONS": String!
Feature for isFeatureSupported. This feature covers addInformationalRankingExpressions.
SEARCH_SPEC_ADVANCED_RANKING_EXPRESSION
const val SEARCH_SPEC_ADVANCED_RANKING_EXPRESSION = "SEARCH_SPEC_ADVANCED_RANKING_EXPRESSION": String!
Feature for isFeatureSupported. This feature covers setRankingStrategy.
SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA
const val SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA = "SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA": String!
Feature for isFeatureSupported. This feature covers GROUPING_TYPE_PER_SCHEMA
SEARCH_SPEC_PROPERTY_WEIGHTS
const val SEARCH_SPEC_PROPERTY_WEIGHTS = "SEARCH_SPEC_PROPERTY_WEIGHTS": String!
Feature for isFeatureSupported. This feature covers setPropertyWeights.
SEARCH_SPEC_RANKING_FUNCTION_FILTER_BY_RANGE
@ExperimentalAppSearchApi
const val SEARCH_SPEC_RANKING_FUNCTION_FILTER_BY_RANGE = "SEARCH_SPEC_RANKING_FUNCTION_FILTER_BY_RANGE": String!
Feature for isFeatureSupported. This feature covers the use of the "filterByRange" function in ranking expressions.
For details on the function in the ranking language, see setRankingStrategy.
SEARCH_SPEC_RANKING_FUNCTION_MAX_MIN_OR_DEFAULT
@ExperimentalAppSearchApi
const val SEARCH_SPEC_RANKING_FUNCTION_MAX_MIN_OR_DEFAULT = "SEARCH_SPEC_RANKING_FUNCTION_MAX_MIN_OR_DEFAULT": String!
Feature for isFeatureSupported. This feature covers the use of the "minOrDefault" and "maxOrDefault" functions in ranking expressions.
For details on the functions in the ranking language, see setRankingStrategy.
SEARCH_SPEC_SEARCH_STRING_PARAMETERS
const val SEARCH_SPEC_SEARCH_STRING_PARAMETERS = "SEARCH_SPEC_SEARCH_STRING_PARAMETERS": String!
Feature for isFeatureSupported. This feature covers the support of the addSearchStringParameters and addSearchStringParameters apis.
SEARCH_SPEC_SET_SEARCH_SOURCE_LOG_TAG
const val SEARCH_SPEC_SET_SEARCH_SOURCE_LOG_TAG = "SEARCH_SPEC_SET_SEARCH_SOURCE_LOG_TAG": String!
Feature for isFeatureSupported. This feature covers setSearchSourceLogTag.
SEARCH_SUGGESTION
const val SEARCH_SUGGESTION = "SEARCH_SUGGESTION": String!
Feature for isFeatureSupported. This feature covers searchSuggestionAsync.
SET_SCHEMA_CIRCULAR_REFERENCES
const val SET_SCHEMA_CIRCULAR_REFERENCES = "SET_SCHEMA_CIRCULAR_REFERENCES": String!
Feature for isFeatureSupported. This feature covers setting schemas with circular references for setSchemaAsync.
SET_SCHEMA_REQUEST_ADD_SCHEMA_TYPE_VISIBLE_TO_CONFIG
const val SET_SCHEMA_REQUEST_ADD_SCHEMA_TYPE_VISIBLE_TO_CONFIG = "SET_SCHEMA_REQUEST_ADD_SCHEMA_TYPE_VISIBLE_TO_CONFIG": String!
Feature for isFeatureSupported. This feature covers addSchemaTypeVisibleToConfig.
SET_SCHEMA_REQUEST_SET_PUBLICLY_VISIBLE
const val SET_SCHEMA_REQUEST_SET_PUBLICLY_VISIBLE = "SET_SCHEMA_REQUEST_SET_PUBLICLY_VISIBLE": String!
Feature for isFeatureSupported. This feature covers setPubliclyVisibleSchema.
TOKENIZER_TYPE_RFC822
const val TOKENIZER_TYPE_RFC822 = "TOKENIZER_TYPE_RFC822": String!
Feature for isFeatureSupported. This feature covers TOKENIZER_TYPE_RFC822.
VERBATIM_SEARCH
const val VERBATIM_SEARCH = "VERBATIM_SEARCH": String!
Feature for isFeatureSupported. This feature covers TOKENIZER_TYPE_VERBATIM and all other verbatim search features within the query language that allows clients to search using the verbatim string operator.
For details on the verbatim string operator, see search.
Public functions
getMaxIndexedProperties
fun getMaxIndexedProperties(): Int
Returns the maximum amount of properties that can be indexed in a Document given the Android API level and AppSearch backend.
A property is defined as all values that are present at a particular path.
isFeatureSupported
fun isFeatureSupported(feature: String): Boolean
Returns whether a feature is supported at run-time. Feature support depends on the feature in question, the AppSearch backend being used and the Android version of the device.
Note: If this method returns false, it is not safe to invoke the methods requiring the desired feature.
| Parameters | |
|---|---|
feature: String |
the feature to be checked |
| Returns | |
|---|---|
Boolean |
whether the capability is supported given the Android API level and AppSearch backend. |