# SearchSpec

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/app/appsearch/SearchSpec#nestedclasses)\|[Constants](https://developer.android.com/reference/android/app/appsearch/SearchSpec#constants)\|[Inherited Constants](https://developer.android.com/reference/android/app/appsearch/SearchSpec#inhconstants)\|[Fields](https://developer.android.com/reference/android/app/appsearch/SearchSpec#lfields)\|[Methods](https://developer.android.com/reference/android/app/appsearch/SearchSpec#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/app/appsearch/SearchSpec#inhmethods)  

# SearchSpec

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchSpec "View this page in Kotlin")\|Java

`
public

final

class
SearchSpec
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[Parcelable](https://developer.android.com/reference/android/os/Parcelable)`


`

|---|----------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.appsearch.SearchSpec |

<br />

*** ** * ** ***

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](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder) Builder for[objects](https://developer.android.com/reference/android/app/appsearch/SearchSpec). |

|                                                                                                                                                                                                                                                                                                                                                                            ### Constants                                                                                                                                                                                                                                                                                                                                                                            ||
|--------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int`                                                              | [EMBEDDING_SEARCH_METRIC_TYPE_COSINE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_COSINE) Cosine similarity as metric for embedding search and ranking.                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `int`                                                              | [EMBEDDING_SEARCH_METRIC_TYPE_DEFAULT](https://developer.android.com/reference/android/app/appsearch/SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_DEFAULT) Use the default metric set in[SearchSpec.getDefaultEmbeddingSearchMetricType()](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getDefaultEmbeddingSearchMetricType())for embedding search and ranking.                                                                                                                                                                                                                                                                                                          |
| `int`                                                              | [EMBEDDING_SEARCH_METRIC_TYPE_DOT_PRODUCT](https://developer.android.com/reference/android/app/appsearch/SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_DOT_PRODUCT) Dot product similarity as metric for embedding search and ranking.                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `int`                                                              | [EMBEDDING_SEARCH_METRIC_TYPE_EUCLIDEAN](https://developer.android.com/reference/android/app/appsearch/SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_EUCLIDEAN) Euclidean distance as metric for embedding search and ranking.                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `int`                                                              | [GROUPING_TYPE_PER_NAMESPACE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#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](https://developer.android.com/reference/android/app/appsearch/SearchSpec#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`                                                              | [GROUPING_TYPE_PER_SCHEMA](https://developer.android.com/reference/android/app/appsearch/SearchSpec#GROUPING_TYPE_PER_SCHEMA) Results should be grouped together by schema type for the purpose of enforcing a limit on the number of results returned per schema type.                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `int`                                                              | [ORDER_ASCENDING](https://developer.android.com/reference/android/app/appsearch/SearchSpec#ORDER_ASCENDING) Search results will be returned in an ascending order.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `int`                                                              | [ORDER_DESCENDING](https://developer.android.com/reference/android/app/appsearch/SearchSpec#ORDER_DESCENDING) Search results will be returned in a descending order.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [String](https://developer.android.com/reference/java/lang/String) | [PROJECTION_SCHEMA_TYPE_WILDCARD](https://developer.android.com/reference/android/app/appsearch/SearchSpec#PROJECTION_SCHEMA_TYPE_WILDCARD) *This constant was deprecated in API level 35. use[SCHEMA_TYPE_WILDCARD](https://developer.android.com/reference/android/app/appsearch/SearchSpec#SCHEMA_TYPE_WILDCARD)instead.*                                                                                                                                                                                                                                                                                                                                                                    |
| `int`                                                              | [RANKING_STRATEGY_ADVANCED_RANKING_EXPRESSION](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_ADVANCED_RANKING_EXPRESSION) Ranked by the advanced ranking expression provided.                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `int`                                                              | [RANKING_STRATEGY_CREATION_TIMESTAMP](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_CREATION_TIMESTAMP) Ranked by document creation timestamps.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `int`                                                              | [RANKING_STRATEGY_DOCUMENT_SCORE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_DOCUMENT_SCORE) Ranked by app-provided document scores.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `int`                                                              | [RANKING_STRATEGY_JOIN_AGGREGATE_SCORE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_JOIN_AGGREGATE_SCORE) Ranked by the aggregated ranking signal of the joined documents.                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `int`                                                              | [RANKING_STRATEGY_NONE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_NONE) No Ranking, results are returned in arbitrary order.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `int`                                                              | [RANKING_STRATEGY_RELEVANCE_SCORE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_RELEVANCE_SCORE) Ranked by document relevance score.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `int`                                                              | [RANKING_STRATEGY_SYSTEM_USAGE_COUNT](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_SYSTEM_USAGE_COUNT) Ranked by number of usages from a system UI surface.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `int`                                                              | [RANKING_STRATEGY_SYSTEM_USAGE_LAST_USED_TIMESTAMP](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_SYSTEM_USAGE_LAST_USED_TIMESTAMP) Ranked by timestamp of last usage from a system UI surface.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `int`                                                              | [RANKING_STRATEGY_USAGE_COUNT](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_USAGE_COUNT) Ranked by number of usages, as reported by the app.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `int`                                                              | [RANKING_STRATEGY_USAGE_LAST_USED_TIMESTAMP](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_USAGE_LAST_USED_TIMESTAMP) Ranked by timestamp of last usage, as reported by the app.                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [String](https://developer.android.com/reference/java/lang/String) | [SCHEMA_TYPE_WILDCARD](https://developer.android.com/reference/android/app/appsearch/SearchSpec#SCHEMA_TYPE_WILDCARD) Schema type to be used in[SearchSpec.Builder.addFilterProperties(String, Collection)](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#addFilterProperties(java.lang.String,%20java.util.Collection<java.lang.String>))and[SearchSpec.Builder.addProjection](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#addProjection(java.lang.String,%20java.util.Collection<java.lang.String>))to apply property paths to all results, excepting any types that have had their own, specific property paths set. |
| `int`                                                              | [TERM_MATCH_EXACT_ONLY](https://developer.android.com/reference/android/app/appsearch/SearchSpec#TERM_MATCH_EXACT_ONLY) Query terms will only match exact tokens in the index.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `int`                                                              | [TERM_MATCH_PREFIX](https://developer.android.com/reference/android/app/appsearch/SearchSpec#TERM_MATCH_PREFIX) Query terms will match indexed tokens when the query term is a prefix of the token.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From interface[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable) |-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR) Descriptor bit used with[describeContents()](https://developer.android.com/reference/android/os/Parcelable#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor.                                                                                                                                            | | `int` | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE) Flag for use with[writeToParcel(Parcel, int)](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

|                                                                                                                                                                                                ### Fields                                                                                                                                                                                                 ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` public static final `[Creator](https://developer.android.com/reference/android/os/Parcelable.Creator)`<`[SearchSpec](https://developer.android.com/reference/android/app/appsearch/SearchSpec)`>` | [CREATOR](https://developer.android.com/reference/android/app/appsearch/SearchSpec#CREATOR) Creator class for[SearchSpec](https://developer.android.com/reference/android/app/appsearch/SearchSpec). |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                                                                                                                                                                                                                                                       | ` `[getAdvancedRankingExpression](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getAdvancedRankingExpression())`() ` Get the advanced ranking expression, or "" if[Builder.setRankingStrategy(String)](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#setRankingStrategy(java.lang.String))was not called.                                                                                                                                                                                                                                                              |
| ` int`                                                                                                                                                                                                                                                                                                                                                                      | ` `[getDefaultEmbeddingSearchMetricType](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getDefaultEmbeddingSearchMetricType())`() ` Returns the default embedding metric type used for embedding search (see[AppSearchSession.search(String, SearchSpec)](https://developer.android.com/reference/android/app/appsearch/AppSearchSession#search(java.lang.String,%20android.app.appsearch.SearchSpec))) and ranking (see[SearchSpec.Builder.setRankingStrategy(java.lang.String)](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#setRankingStrategy(java.lang.String))). |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[EmbeddingVector](https://developer.android.com/reference/android/app/appsearch/EmbeddingVector)`>`                                                                                                                                                                                                     | ` `[getEmbeddingParameters](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getEmbeddingParameters())`() ` Returns the list of[EmbeddingVector](https://developer.android.com/reference/android/app/appsearch/EmbeddingVector)that can be referenced in the query through the "getEmbeddingParameter({index})" function.                                                                                                                                                                                                                                                                                    |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>`                                                                                                                                                                                                                                   | ` `[getFilterDocumentIds](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getFilterDocumentIds())`() ` Returns the list of document ids to search over.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>`                                                                                                                                                                                                                                   | ` `[getFilterNamespaces](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getFilterNamespaces())`() ` Returns the list of namespaces to search over.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>`                                                                                                                                                                                                                                   | ` `[getFilterPackageNames](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getFilterPackageNames())`() ` Returns the list of package name filters to search over.                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` `[Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>>`                                                                                             | ` `[getFilterProperties](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getFilterProperties())`() ` Returns the map of schema and target properties to search over.                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>`                                                                                                                                                                                                                                   | ` `[getFilterSchemas](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getFilterSchemas())`() ` Returns the list of schema types to search for.                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>`                                                                                                                                                                                                                                   | ` `[getInformationalRankingExpressions](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getInformationalRankingExpressions())`() ` Returns the informational ranking expressions.                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` `[JoinSpec](https://developer.android.com/reference/android/app/appsearch/JoinSpec)                                                                                                                                                                                                                                                                                       | ` `[getJoinSpec](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getJoinSpec())`() ` Returns specification on which documents need to be joined.                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` int`                                                                                                                                                                                                                                                                                                                                                                      | ` `[getMaxSnippetSize](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getMaxSnippetSize())`() ` Returns the maximum size of a snippet in characters.                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ` int`                                                                                                                                                                                                                                                                                                                                                                      | ` `[getOrder](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getOrder())`() ` Returns the order of returned search results (descending or ascending).                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` `[Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[List](https://developer.android.com/reference/java/util/List)`<`[PropertyPath](https://developer.android.com/reference/android/app/appsearch/PropertyPath)`>>`                                                                     | ` `[getProjectionPaths](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getProjectionPaths())`() ` Returns a map from schema type to property paths to be used for projection.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` `[Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>>`                                                                                             | ` `[getProjections](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getProjections())`() ` Returns a map from schema type to property paths to be used for projection.                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` `[Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[Map](https://developer.android.com/reference/java/util/Map)`<`[PropertyPath](https://developer.android.com/reference/android/app/appsearch/PropertyPath)`, `[Double](https://developer.android.com/reference/java/lang/Double)`>>` | ` `[getPropertyWeightPaths](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getPropertyWeightPaths())`() ` Returns properties weights to be used for scoring.                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` `[Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[Double](https://developer.android.com/reference/java/lang/Double)`>>`                         | ` `[getPropertyWeights](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getPropertyWeights())`() ` Returns properties weights to be used for scoring.                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ` int`                                                                                                                                                                                                                                                                                                                                                                      | ` `[getRankingStrategy](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getRankingStrategy())`() ` Returns the ranking strategy.                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` int`                                                                                                                                                                                                                                                                                                                                                                      | ` `[getResultCountPerPage](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getResultCountPerPage())`() ` Returns the number of results per page in the result set.                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` int`                                                                                                                                                                                                                                                                                                                                                                      | ` `[getResultGroupingLimit](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getResultGroupingLimit())`() ` Get the maximum number of results to return for each group.                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` int`                                                                                                                                                                                                                                                                                                                                                                      | ` `[getResultGroupingTypeFlags](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getResultGroupingTypeFlags())`() ` Get the type of grouping limit to apply, or 0 if[Builder.setResultGrouping](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#setResultGrouping(int,%20int))was not called.                                                                                                                                                                                                                                                                               |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                                                                                                                                                                                                                                                       | ` `[getSearchSourceLogTag](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getSearchSourceLogTag())`() ` Gets a tag to indicate the source of this search, or`null`if[SearchSpec.Builder.setSearchSourceLogTag(java.lang.String)](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#setSearchSourceLogTag(java.lang.String))was not called.                                                                                                                                                                                                                                  |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>`                                                                                                                                                                                                                                   | ` `[getSearchStringParameters](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getSearchStringParameters())`() ` Returns the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function.                                                                                                                                                                                                                                                                                                                                                        |
| ` int`                                                                                                                                                                                                                                                                                                                                                                      | ` `[getSnippetCount](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getSnippetCount())`() ` Returns how many documents to generate snippets for.                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` int`                                                                                                                                                                                                                                                                                                                                                                      | ` `[getSnippetCountPerProperty](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getSnippetCountPerProperty())`() ` Returns how many matches for each property of a matching document to generate snippets for.                                                                                                                                                                                                                                                                                                                                                                                              |
| ` int`                                                                                                                                                                                                                                                                                                                                                                      | ` `[getTermMatch](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getTermMatch())`() ` Returns how the query terms should match terms in the index.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` boolean`                                                                                                                                                                                                                                                                                                                                                                  | ` `[isListFilterHasPropertyFunctionEnabled](https://developer.android.com/reference/android/app/appsearch/SearchSpec#isListFilterHasPropertyFunctionEnabled())`() ` Returns whether the LIST_FILTER_HAS_PROPERTY_FUNCTION feature is enabled.                                                                                                                                                                                                                                                                                                                                                                                        |
| ` boolean`                                                                                                                                                                                                                                                                                                                                                                  | ` `[isListFilterMatchScoreExpressionFunctionEnabled](https://developer.android.com/reference/android/app/appsearch/SearchSpec#isListFilterMatchScoreExpressionFunctionEnabled())`() ` Returns whether the LIST_FILTER_MATCH_SCORE_EXPRESSION_FUNCTION feature is enabled.                                                                                                                                                                                                                                                                                                                                                            |
| ` boolean`                                                                                                                                                                                                                                                                                                                                                                  | ` `[isListFilterQueryLanguageEnabled](https://developer.android.com/reference/android/app/appsearch/SearchSpec#isListFilterQueryLanguageEnabled())`() ` Returns whether the LIST_FILTER_QUERY_LANGUAGE feature is enabled.                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` boolean`                                                                                                                                                                                                                                                                                                                                                                  | ` `[isNumericSearchEnabled](https://developer.android.com/reference/android/app/appsearch/SearchSpec#isNumericSearchEnabled())`() ` Returns whether the NUMERIC_SEARCH feature is enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` boolean`                                                                                                                                                                                                                                                                                                                                                                  | ` `[isScorablePropertyRankingEnabled](https://developer.android.com/reference/android/app/appsearch/SearchSpec#isScorablePropertyRankingEnabled())`() ` Returns whether the ScorablePropertyRanking feature is enabled.                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` boolean`                                                                                                                                                                                                                                                                                                                                                                  | ` `[isVerbatimSearchEnabled](https://developer.android.com/reference/android/app/appsearch/SearchSpec#isVerbatimSearchEnabled())`() ` Returns whether the VERBATIM_SEARCH feature is enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` boolean`                                                                                                                                                                                                                                                                                                                                                                  | ` `[shouldRetrieveEmbeddingMatchInfos](https://developer.android.com/reference/android/app/appsearch/SearchSpec#shouldRetrieveEmbeddingMatchInfos())`() ` Returns whether to retrieve embedding match infos as a part of[SearchResult.getMatchInfos()](https://developer.android.com/reference/android/app/appsearch/SearchResult#getMatchInfos())                                                                                                                                                                                                                                                                                   |
| ` void`                                                                                                                                                                                                                                                                                                                                                                     | ` `[writeToParcel](https://developer.android.com/reference/android/app/appsearch/SearchSpec#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` dest, int flags) ` Flatten this object in to a Parcel.                                                                                                                                                                                                                                                                                                                                                                   |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable)` ` |------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int`  | ` `[describeContents](https://developer.android.com/reference/android/os/Parcelable#describeContents())`() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.                                    | | ` abstract void` | ` `[writeToParcel](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` dest, int flags) ` Flatten this object in to a Parcel. | ||

## Constants

### EMBEDDING_SEARCH_METRIC_TYPE_COSINE

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 16](https://developer.android.com/sdkExtensions)  

```
public static final int EMBEDDING_SEARCH_METRIC_TYPE_COSINE
```

Cosine similarity as metric for embedding search and ranking.

<br />

Constant Value: 1 (0x00000001)  

### EMBEDDING_SEARCH_METRIC_TYPE_DEFAULT

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 16](https://developer.android.com/sdkExtensions)  

```
public static final int EMBEDDING_SEARCH_METRIC_TYPE_DEFAULT
```

Use the default metric set in[SearchSpec.getDefaultEmbeddingSearchMetricType()](https://developer.android.com/reference/android/app/appsearch/SearchSpec#getDefaultEmbeddingSearchMetricType())for embedding search and ranking.

<br />

Constant Value: 0 (0x00000000)  

### EMBEDDING_SEARCH_METRIC_TYPE_DOT_PRODUCT

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 16](https://developer.android.com/sdkExtensions)  

```
public static final int EMBEDDING_SEARCH_METRIC_TYPE_DOT_PRODUCT
```

Dot product similarity as metric for embedding search and ranking.

<br />

Constant Value: 2 (0x00000002)  

### EMBEDDING_SEARCH_METRIC_TYPE_EUCLIDEAN

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 16](https://developer.android.com/sdkExtensions)  

```
public static final int EMBEDDING_SEARCH_METRIC_TYPE_EUCLIDEAN
```

Euclidean distance as metric for embedding search and ranking.

<br />

Constant Value: 3 (0x00000003)  

### GROUPING_TYPE_PER_NAMESPACE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final 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.

<br />

Constant Value: 2 (0x00000002)  

### GROUPING_TYPE_PER_PACKAGE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final 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.

<br />

Constant Value: 1 (0x00000001)  

### GROUPING_TYPE_PER_SCHEMA

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public static final int GROUPING_TYPE_PER_SCHEMA
```

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

<br />

Constant Value: 4 (0x00000004)  

### ORDER_ASCENDING

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ORDER_ASCENDING
```

Search results will be returned in an ascending order.

<br />

Constant Value: 1 (0x00000001)  

### ORDER_DESCENDING

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ORDER_DESCENDING
```

Search results will be returned in a descending order.

<br />

Constant Value: 0 (0x00000000)  

### PROJECTION_SCHEMA_TYPE_WILDCARD

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String PROJECTION_SCHEMA_TYPE_WILDCARD
```

<br />

**This constant was deprecated in API level 35.**   
use[SCHEMA_TYPE_WILDCARD](https://developer.android.com/reference/android/app/appsearch/SearchSpec#SCHEMA_TYPE_WILDCARD)instead.

Schema type to be used in[SearchSpec.Builder.addProjection](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#addProjection(java.lang.String,%20java.util.Collection<java.lang.String>))to apply property paths to all results, excepting any types that have had their own, specific property paths set.

<br />

Constant Value: "\*"  

### RANKING_STRATEGY_ADVANCED_RANKING_EXPRESSION

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 7](https://developer.android.com/sdkExtensions)  

```
public static final int RANKING_STRATEGY_ADVANCED_RANKING_EXPRESSION
```

Ranked by the advanced ranking expression provided.

<br />

Constant Value: 9 (0x00000009)  

### RANKING_STRATEGY_CREATION_TIMESTAMP

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int RANKING_STRATEGY_CREATION_TIMESTAMP
```

Ranked by document creation timestamps.

<br />

Constant Value: 2 (0x00000002)  

### RANKING_STRATEGY_DOCUMENT_SCORE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int RANKING_STRATEGY_DOCUMENT_SCORE
```

Ranked by app-provided document scores.

<br />

Constant Value: 1 (0x00000001)  

### RANKING_STRATEGY_JOIN_AGGREGATE_SCORE

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 7](https://developer.android.com/sdkExtensions)  

```
public static final int RANKING_STRATEGY_JOIN_AGGREGATE_SCORE
```

Ranked by the aggregated ranking signal of the joined documents.

Which aggregation strategy is used to determine a ranking signal is specified in the[JoinSpec](https://developer.android.com/reference/android/app/appsearch/JoinSpec)set by[Builder.setJoinSpec](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#setJoinSpec(android.app.appsearch.JoinSpec)). This ranking strategy may not be used if no[JoinSpec](https://developer.android.com/reference/android/app/appsearch/JoinSpec)is provided.

<br />

**See also:**

- [SearchSpec.Builder.build()](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#build())

Constant Value: 8 (0x00000008)  

### RANKING_STRATEGY_NONE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int RANKING_STRATEGY_NONE
```

No Ranking, results are returned in arbitrary order.

<br />

Constant Value: 0 (0x00000000)  

### RANKING_STRATEGY_RELEVANCE_SCORE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int RANKING_STRATEGY_RELEVANCE_SCORE
```

Ranked by document relevance score.

<br />

Constant Value: 3 (0x00000003)  

### RANKING_STRATEGY_SYSTEM_USAGE_COUNT

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int RANKING_STRATEGY_SYSTEM_USAGE_COUNT
```

Ranked by number of usages from a system UI surface.

<br />

Constant Value: 6 (0x00000006)  

### RANKING_STRATEGY_SYSTEM_USAGE_LAST_USED_TIMESTAMP

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int RANKING_STRATEGY_SYSTEM_USAGE_LAST_USED_TIMESTAMP
```

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

<br />

Constant Value: 7 (0x00000007)  

### RANKING_STRATEGY_USAGE_COUNT

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int RANKING_STRATEGY_USAGE_COUNT
```

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

<br />

Constant Value: 4 (0x00000004)  

### RANKING_STRATEGY_USAGE_LAST_USED_TIMESTAMP

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int RANKING_STRATEGY_USAGE_LAST_USED_TIMESTAMP
```

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

<br />

Constant Value: 5 (0x00000005)  

### SCHEMA_TYPE_WILDCARD

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public static final String SCHEMA_TYPE_WILDCARD
```

Schema type to be used in[SearchSpec.Builder.addFilterProperties(String, Collection)](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#addFilterProperties(java.lang.String,%20java.util.Collection<java.lang.String>))and[SearchSpec.Builder.addProjection](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#addProjection(java.lang.String,%20java.util.Collection<java.lang.String>))to apply property paths to all results, excepting any types that have had their own, specific property paths set.

<br />

Constant Value: "\*"  

### TERM_MATCH_EXACT_ONLY

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int TERM_MATCH_EXACT_ONLY
```

Query terms will only match exact tokens in the index.

For example, a query term "foo" will only match indexed token "foo", and not "foot" or "football".

<br />

Constant Value: 1 (0x00000001)  

### TERM_MATCH_PREFIX

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int TERM_MATCH_PREFIX
```

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

For example, a query term "foo" will match indexed tokens like "foo", "foot", and "football".

<br />

Constant Value: 2 (0x00000002)

## Fields

### CREATOR

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public static final Creator<SearchSpec> CREATOR
```

Creator class for[SearchSpec](https://developer.android.com/reference/android/app/appsearch/SearchSpec).

<br />

## Public methods

### getAdvancedRankingExpression

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 7](https://developer.android.com/sdkExtensions)  

```
public String getAdvancedRankingExpression ()
```

Get the advanced ranking expression, or "" if[Builder.setRankingStrategy(String)](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#setRankingStrategy(java.lang.String))was not called.

<br />

|                                                Returns                                                 ||
|--------------------------------------------------------------------|------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | This value cannot be`null`. <br /> |

### getDefaultEmbeddingSearchMetricType

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 16](https://developer.android.com/sdkExtensions)  

```
public int getDefaultEmbeddingSearchMetricType ()
```

Returns the default embedding metric type used for embedding search (see[AppSearchSession.search(String, SearchSpec)](https://developer.android.com/reference/android/app/appsearch/AppSearchSession#search(java.lang.String,%20android.app.appsearch.SearchSpec))) and ranking (see[SearchSpec.Builder.setRankingStrategy(java.lang.String)](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#setRankingStrategy(java.lang.String))).

<br />

|                                                                                                                                                                                                                                                                                                                          Returns                                                                                                                                                                                                                                                                                                                           ||
|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | Value is[EMBEDDING_SEARCH_METRIC_TYPE_DEFAULT](https://developer.android.com/reference/android/app/appsearch/SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_DEFAULT),[EMBEDDING_SEARCH_METRIC_TYPE_COSINE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_COSINE),[EMBEDDING_SEARCH_METRIC_TYPE_DOT_PRODUCT](https://developer.android.com/reference/android/app/appsearch/SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_DOT_PRODUCT), or[EMBEDDING_SEARCH_METRIC_TYPE_EUCLIDEAN](https://developer.android.com/reference/android/app/appsearch/SearchSpec#EMBEDDING_SEARCH_METRIC_TYPE_EUCLIDEAN) <br /> |

### getEmbeddingParameters

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 16](https://developer.android.com/sdkExtensions)  

```
public List<EmbeddingVector> getEmbeddingParameters ()
```

Returns the list of[EmbeddingVector](https://developer.android.com/reference/android/app/appsearch/EmbeddingVector)that can be referenced in the query through the "getEmbeddingParameter({index})" function.

<br />

|                                                                                                 Returns                                                                                                  ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[EmbeddingVector](https://developer.android.com/reference/android/app/appsearch/EmbeddingVector)`>` | This value cannot be`null`. <br /> |

**See also:**

- [AppSearchSession.search(String, SearchSpec)](https://developer.android.com/reference/android/app/appsearch/AppSearchSession#search(java.lang.String,%20android.app.appsearch.SearchSpec))  

### getFilterDocumentIds

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 17](https://developer.android.com/sdkExtensions)  

```
public List<String> getFilterDocumentIds ()
```

Returns the list of document ids to search over.

If empty, the query will search over all documents.

<br />

|                                                                                  Returns                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | This value cannot be`null`. <br /> |

### getFilterNamespaces

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public List<String> getFilterNamespaces ()
```

Returns the list of namespaces to search over.

If empty, the query will search over all namespaces.

<br />

|                                                                                  Returns                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | This value cannot be`null`. <br /> |

### getFilterPackageNames

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public List<String> getFilterPackageNames ()
```

Returns the list of package name filters to search over.

If empty, the query will search over all packages that the caller has access to. If package names are specified which caller doesn't have access to, then those package names will be ignored.

<br />

|                                                                                  Returns                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | This value cannot be`null`. <br /> |

### getFilterProperties

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public Map<String, List<String>> getFilterProperties ()
```

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

If empty, will search over all schema and properties.

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

<br />

|                                                                                                                                                     Returns                                                                                                                                                      ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>>` | This value cannot be`null`. <br /> |

### getFilterSchemas

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public List<String> getFilterSchemas ()
```

Returns the list of schema types to search for.

If empty, the query will search over all schema types.

<br />

|                                                                                  Returns                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | This value cannot be`null`. <br /> |

### getInformationalRankingExpressions

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 16](https://developer.android.com/sdkExtensions)  

```
public List<String> getInformationalRankingExpressions ()
```

Returns the informational ranking expressions.

<br />

|                                                                                  Returns                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | This value cannot be`null`. <br /> |

**See also:**

- [SearchSpec.Builder.addInformationalRankingExpressions(String)](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#addInformationalRankingExpressions(java.lang.String[]))  

### getJoinSpec

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 7](https://developer.android.com/sdkExtensions)  

```
public JoinSpec getJoinSpec ()
```

Returns specification on which documents need to be joined.

<br />

|                                                       Returns                                                       ||
|------------------------------------------------------------------------------------|---------------------------------|
| [JoinSpec](https://developer.android.com/reference/android/app/appsearch/JoinSpec) | This value may be`null`. <br /> |

### getMaxSnippetSize

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getMaxSnippetSize ()
```

Returns the maximum size of a snippet in characters.

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getOrder

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getOrder ()
```

Returns the order of returned search results (descending or ascending).

<br />

|                                                                                                                      Returns                                                                                                                       ||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | Value is[ORDER_DESCENDING](https://developer.android.com/reference/android/app/appsearch/SearchSpec#ORDER_DESCENDING), or[ORDER_ASCENDING](https://developer.android.com/reference/android/app/appsearch/SearchSpec#ORDER_ASCENDING) <br /> |

### getProjectionPaths

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 7](https://developer.android.com/sdkExtensions)  

```
public Map<String, List<PropertyPath>> getProjectionPaths ()
```

Returns a map from schema type to property paths to be used for projection.

If the map is empty, then all properties will be retrieved for all results.

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

<br />

|                                                                                                                                                                                                                                           Returns                                                                                                                                                                                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[List](https://developer.android.com/reference/java/util/List)`<`[PropertyPath](https://developer.android.com/reference/android/app/appsearch/PropertyPath)`>>` | A mapping of schema types to lists of projection[PropertyPath](https://developer.android.com/reference/android/app/appsearch/PropertyPath)objects. This value cannot be`null`. <br /> |

### getProjections

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Map<String, List<String>> getProjections ()
```

Returns a map from schema type to property paths to be used for projection.

If the map is empty, then all properties will be retrieved for all results.

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

<br />

|                                                                                                                                                                                  Returns                                                                                                                                                                                   ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|
| [Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>>` | A mapping of schema types to lists of projection strings. This value cannot be`null`. <br /> |

### getPropertyWeightPaths

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 7](https://developer.android.com/sdkExtensions)  

```
public Map<String, Map<PropertyPath, Double>> getPropertyWeightPaths ()
```

Returns properties weights to be used for scoring.

Calling this function repeatedly is inefficient. Prefer to retain the[Map](https://developer.android.com/reference/java/util/Map)returned by this function, rather than calling it multiple times.

<br />

|                                                                                                                                                                                                                                                                                        Returns                                                                                                                                                                                                                                                                                        ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[Map](https://developer.android.com/reference/java/util/Map)`<`[PropertyPath](https://developer.android.com/reference/android/app/appsearch/PropertyPath)`, `[Double](https://developer.android.com/reference/java/lang/Double)`>>` | a[Map](https://developer.android.com/reference/java/util/Map)of schema type to an inner-map of property paths of the schema type to the weight to set for that property. This value cannot be`null`. <br /> |

### getPropertyWeights

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 7](https://developer.android.com/sdkExtensions)  

```
public Map<String, Map<String, Double>> getPropertyWeights ()
```

Returns properties weights to be used for scoring.

Calling this function repeatedly is inefficient. Prefer to retain the[Map](https://developer.android.com/reference/java/util/Map)returned by this function, rather than calling it multiple times.

<br />

|                                                                                                                                                                                                                                                                            Returns                                                                                                                                                                                                                                                                            ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[Double](https://developer.android.com/reference/java/lang/Double)`>>` | a[Map](https://developer.android.com/reference/java/util/Map)of schema type to an inner-map of property paths of the schema type to the weight to set for that property. This value cannot be`null`. <br /> |

### getRankingStrategy

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getRankingStrategy ()
```

Returns the ranking strategy.

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Returns                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ||
|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | Value is[RANKING_STRATEGY_NONE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_NONE),[RANKING_STRATEGY_DOCUMENT_SCORE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_DOCUMENT_SCORE),[RANKING_STRATEGY_CREATION_TIMESTAMP](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_CREATION_TIMESTAMP),[RANKING_STRATEGY_RELEVANCE_SCORE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_RELEVANCE_SCORE),[RANKING_STRATEGY_USAGE_COUNT](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_USAGE_COUNT),[RANKING_STRATEGY_USAGE_LAST_USED_TIMESTAMP](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_USAGE_LAST_USED_TIMESTAMP),[RANKING_STRATEGY_SYSTEM_USAGE_COUNT](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_SYSTEM_USAGE_COUNT),[RANKING_STRATEGY_SYSTEM_USAGE_LAST_USED_TIMESTAMP](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_SYSTEM_USAGE_LAST_USED_TIMESTAMP),[RANKING_STRATEGY_JOIN_AGGREGATE_SCORE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_JOIN_AGGREGATE_SCORE), or[RANKING_STRATEGY_ADVANCED_RANKING_EXPRESSION](https://developer.android.com/reference/android/app/appsearch/SearchSpec#RANKING_STRATEGY_ADVANCED_RANKING_EXPRESSION) <br /> |

### getResultCountPerPage

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getResultCountPerPage ()
```

Returns the number of results per page in the result set.

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getResultGroupingLimit

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getResultGroupingLimit ()
```

Get the maximum number of results to return for each group.

<br />

|                                                                                                                           Returns                                                                                                                           ||
|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | the maximum number of results to return for each group or 0 if[SearchSpec.Builder.setResultGrouping(int, int)](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#setResultGrouping(int,%20int))was not called. <br /> |

### getResultGroupingTypeFlags

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getResultGroupingTypeFlags ()
```

Get the type of grouping limit to apply, or 0 if[Builder.setResultGrouping](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#setResultGrouping(int,%20int))was not called.

<br />

|                                                                                                                                                                                                                         Returns                                                                                                                                                                                                                          ||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | Value is either`0`or a combination of[GROUPING_TYPE_PER_PACKAGE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#GROUPING_TYPE_PER_PACKAGE),[GROUPING_TYPE_PER_NAMESPACE](https://developer.android.com/reference/android/app/appsearch/SearchSpec#GROUPING_TYPE_PER_NAMESPACE), and[GROUPING_TYPE_PER_SCHEMA](https://developer.android.com/reference/android/app/appsearch/SearchSpec#GROUPING_TYPE_PER_SCHEMA) <br /> |

### getSearchSourceLogTag

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public String getSearchSourceLogTag ()
```

Gets a tag to indicate the source of this search, or`null`if[SearchSpec.Builder.setSearchSourceLogTag(java.lang.String)](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#setSearchSourceLogTag(java.lang.String))was not called.

Some AppSearch implementations may log a hash of this tag using statsd. This tag may be used for tracing performance issues and crashes to a component of an app.

Call[Builder.setSearchSourceLogTag](https://developer.android.com/reference/android/app/appsearch/SearchSpec.Builder#setSearchSourceLogTag(java.lang.String))and give a unique value if you want to distinguish this search scenario with other search scenarios during performance analysis.

Under no circumstances will AppSearch log the raw String value using statsd, but it will be provided as-is to custom`AppSearchLogger`implementations you have registered in your app.

<br />

|                                  Returns                                   ||
|--------------------------------------------------------------------|--------|
| [String](https://developer.android.com/reference/java/lang/String) | <br /> |

### getSearchStringParameters

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 16](https://developer.android.com/sdkExtensions)  

```
public List<String> getSearchStringParameters ()
```

Returns the list of String parameters that can be referenced in the query through the "getSearchStringParameter({index})" function.

<br />

|                                                                                  Returns                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | This value cannot be`null`. <br /> |

**See also:**

- [AppSearchSession.search(String, SearchSpec)](https://developer.android.com/reference/android/app/appsearch/AppSearchSession#search(java.lang.String,%20android.app.appsearch.SearchSpec))  

### getSnippetCount

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getSnippetCount ()
```

Returns how many documents to generate snippets for.

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getSnippetCountPerProperty

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getSnippetCountPerProperty ()
```

Returns how many matches for each property of a matching document to generate snippets for.

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getTermMatch

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getTermMatch ()
```

Returns how the query terms should match terms in the index.

<br />

|                                                                                                                             Returns                                                                                                                              ||
|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | Value is[TERM_MATCH_EXACT_ONLY](https://developer.android.com/reference/android/app/appsearch/SearchSpec#TERM_MATCH_EXACT_ONLY), or[TERM_MATCH_PREFIX](https://developer.android.com/reference/android/app/appsearch/SearchSpec#TERM_MATCH_PREFIX) <br /> |

### isListFilterHasPropertyFunctionEnabled

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public boolean isListFilterHasPropertyFunctionEnabled ()
```

Returns whether the LIST_FILTER_HAS_PROPERTY_FUNCTION feature is enabled.

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### isListFilterMatchScoreExpressionFunctionEnabled

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 17](https://developer.android.com/sdkExtensions)  

```
public boolean isListFilterMatchScoreExpressionFunctionEnabled ()
```

Returns whether the LIST_FILTER_MATCH_SCORE_EXPRESSION_FUNCTION feature is enabled.

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### isListFilterQueryLanguageEnabled

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 7](https://developer.android.com/sdkExtensions)  

```
public boolean isListFilterQueryLanguageEnabled ()
```

Returns whether the LIST_FILTER_QUERY_LANGUAGE feature is enabled.

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### isNumericSearchEnabled

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 7](https://developer.android.com/sdkExtensions)  

```
public boolean isNumericSearchEnabled ()
```

Returns whether the NUMERIC_SEARCH feature is enabled.

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### isScorablePropertyRankingEnabled

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 17](https://developer.android.com/sdkExtensions)  

```
public boolean isScorablePropertyRankingEnabled ()
```

Returns whether the ScorablePropertyRanking feature is enabled.

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### isVerbatimSearchEnabled

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 7](https://developer.android.com/sdkExtensions)  

```
public boolean isVerbatimSearchEnabled ()
```

Returns whether the VERBATIM_SEARCH feature is enabled.

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### shouldRetrieveEmbeddingMatchInfos

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[T Extensions 18](https://developer.android.com/sdkExtensions)  

```
public boolean shouldRetrieveEmbeddingMatchInfos ()
```

Returns whether to retrieve embedding match infos as a part of[SearchResult.getMatchInfos()](https://developer.android.com/reference/android/app/appsearch/SearchResult#getMatchInfos())

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### writeToParcel

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

|                                                                                                                                                                                                                               Parameters                                                                                                                                                                                                                                ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dest`  | `Parcel`: This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or[Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE). Value is either`0`or a combination of[Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES <br /> |