# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Constants | Methods | Inherited Methods

# SearchSpec

`public final class SearchSpec`
`extends Object` ``

java.lang.Object
↳ | android.app.appsearch.SearchSpec

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

## Summary

### Nested classes
`class` | `SearchSpec.Builder` Builder for `objects`.

### Constants
`int` | `GROUPING_TYPE_PER_NAMESPACE` Results should be grouped together by namespace for the purpose of enforcing a limit on the number of results returned per namespace.
`int` | `GROUPING_TYPE_PER_PACKAGE` Results should be grouped together by package for the purpose of enforcing a limit on the number of results returned per package.
`int` | `ORDER_ASCENDING` Search results will be returned in an ascending order.
`int` | `ORDER_DESCENDING` Search results will be returned in a descending order.
`String` | `PROJECTION_SCHEMA_TYPE_WILDCARD` Schema type to be used in `SearchSpec.Builder#addProjection` to apply property paths to all results, excepting any types that have had their own, specific property paths set.
`int` | `RANKING_STRATEGY_CREATION_TIMESTAMP` Ranked by document creation timestamps.
`int` | `RANKING_STRATEGY_DOCUMENT_SCORE` Ranked by app-provided document scores.
`int` | `RANKING_STRATEGY_NONE` No Ranking, results are returned in arbitrary order.
`int` | `RANKING_STRATEGY_RELEVANCE_SCORE` Ranked by document relevance score.
`int` | `RANKING_STRATEGY_SYSTEM_USAGE_COUNT` Ranked by number of usages from a system UI surface.
`int` | `RANKING_STRATEGY_SYSTEM_USAGE_LAST_USED_TIMESTAMP` Ranked by timestamp of last usage from a system UI surface.
`int` | `RANKING_STRATEGY_USAGE_COUNT` Ranked by number of usages, as reported by the app.
`int` | `RANKING_STRATEGY_USAGE_LAST_USED_TIMESTAMP` Ranked by timestamp of last usage, as reported by the app.
`int` | `TERM_MATCH_EXACT_ONLY` Query terms will only match exact tokens in the index.
`int` | `TERM_MATCH_PREFIX` Query terms will match indexed tokens when the query term is a prefix of the token.

### Public methods
`List<String>` | `getFilterNamespaces()` Returns the list of namespaces to search over.
`List<String>` | `getFilterPackageNames()` Returns the list of package name filters to search over.
`List<String>` | `getFilterSchemas()` Returns the list of schema types to search for.
`int` | `getMaxSnippetSize()` Returns the maximum size of a snippet in characters.
`int` | `getOrder()` Returns the order of returned search results (descending or ascending).
`Map<String, List<String>>` | `getProjections()` Returns a map from schema type to property paths to be used for projection.
`int` | `getRankingStrategy()` Returns the ranking strategy.
`int` | `getResultCountPerPage()` Returns the number of results per page in the result set.
`int` | `getResultGroupingLimit()` Get the maximum number of results to return for each group.
`int` | `getResultGroupingTypeFlags()` Get the type of grouping limit to apply, or 0 if `Builder#setResultGrouping` was not called.
`int` | `getSnippetCount()` Returns how many documents to generate snippets for.
`int` | `getSnippetCountPerProperty()` Returns how many matches for each property of a matching document to generate snippets for.
`int` | `getTermMatch()` Returns how the query terms should match terms in the index.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Constants

### GROUPING_TYPE_PER_NAMESPACE

    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.

Constant Value: 2 (0x00000002)

### GROUPING_TYPE_PER_PACKAGE

    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.

Constant Value: 1 (0x00000001)

### ORDER_ASCENDING

    public static final int ORDER_ASCENDING

Search results will be returned in an ascending order.

Constant Value: 1 (0x00000001)

### ORDER_DESCENDING

    public static final int ORDER_DESCENDING

Search results will be returned in a descending order.

Constant Value: 0 (0x00000000)

### PROJECTION_SCHEMA_TYPE_WILDCARD

    public static final String PROJECTION_SCHEMA_TYPE_WILDCARD

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

Constant Value: "*"

### RANKING_STRATEGY_CREATION_TIMESTAMP

    public static final int RANKING_STRATEGY_CREATION_TIMESTAMP

Ranked by document creation timestamps.

Constant Value: 2 (0x00000002)

### RANKING_STRATEGY_DOCUMENT_SCORE

    public static final int RANKING_STRATEGY_DOCUMENT_SCORE

Ranked by app-provided document scores.

Constant Value: 1 (0x00000001)

### RANKING_STRATEGY_NONE

    public static final int RANKING_STRATEGY_NONE

No Ranking, results are returned in arbitrary order.

Constant Value: 0 (0x00000000)

### RANKING_STRATEGY_RELEVANCE_SCORE

    public static final int RANKING_STRATEGY_RELEVANCE_SCORE

Ranked by document relevance score.

Constant Value: 3 (0x00000003)

### RANKING_STRATEGY_SYSTEM_USAGE_COUNT

    public static final int RANKING_STRATEGY_SYSTEM_USAGE_COUNT

Ranked by number of usages from a system UI surface.

Constant Value: 6 (0x00000006)

### RANKING_STRATEGY_SYSTEM_USAGE_LAST_USED_TIMESTAMP

    public static final int RANKING_STRATEGY_SYSTEM_USAGE_LAST_USED_TIMESTAMP

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

Constant Value: 7 (0x00000007)

### RANKING_STRATEGY_USAGE_COUNT

    public static final int RANKING_STRATEGY_USAGE_COUNT

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

Constant Value: 4 (0x00000004)

### RANKING_STRATEGY_USAGE_LAST_USED_TIMESTAMP

    public static final int RANKING_STRATEGY_USAGE_LAST_USED_TIMESTAMP

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

Constant Value: 5 (0x00000005)

### TERM_MATCH_EXACT_ONLY

    public static final int TERM_MATCH_EXACT_ONLY

Query terms will only match exact tokens in the index.

Ex. A query term "foo" will only match indexed token "foo", and not "foot" or "football".

Constant Value: 1 (0x00000001)

### TERM_MATCH_PREFIX

    public static final int TERM_MATCH_PREFIX

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

Ex. A query term "foo" will match indexed tokens like "foo", "foot", and "football".

Constant Value: 2 (0x00000002)

## Public methods

### getFilterNamespaces

    public List<String> getFilterNamespaces ()

Returns the list of namespaces to search over.

If empty, the query will search over all namespaces.

Returns
`List<String>` | This value cannot be `null`.

### getFilterPackageNames

    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.

Returns
`List<String>` | This value cannot be `null`.

### getFilterSchemas

    public List<String> getFilterSchemas ()

Returns the list of schema types to search for.

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

Returns
`List<String>` | This value cannot be `null`.

### getMaxSnippetSize

    public int getMaxSnippetSize ()

Returns the maximum size of a snippet in characters.

Returns
`int` |

### getOrder

    public int getOrder ()

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

Returns
`int` | Value is `ORDER_DESCENDING`, or `ORDER_ASCENDING`

### getProjections

    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.

Returns
`Map<String, List<String>>` | This value cannot be `null`.

### getRankingStrategy

    public int getRankingStrategy ()

Returns the ranking strategy.

Returns
`int` | Value is `RANKING_STRATEGY_NONE`, `RANKING_STRATEGY_DOCUMENT_SCORE`, `RANKING_STRATEGY_CREATION_TIMESTAMP`, `RANKING_STRATEGY_RELEVANCE_SCORE`, `RANKING_STRATEGY_USAGE_COUNT`, `RANKING_STRATEGY_USAGE_LAST_USED_TIMESTAMP`, `RANKING_STRATEGY_SYSTEM_USAGE_COUNT`, or `RANKING_STRATEGY_SYSTEM_USAGE_LAST_USED_TIMESTAMP`

### getResultCountPerPage

    public int getResultCountPerPage ()

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

Returns
`int` |

### getResultGroupingLimit

    public int getResultGroupingLimit ()

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

Returns
`int` | the maximum number of results to return for each group or Integer.MAX_VALUE if `SearchSpec.Builder.setResultGrouping(int, int)` was not called.

### getResultGroupingTypeFlags

    public int getResultGroupingTypeFlags ()

Get the type of grouping limit to apply, or 0 if `Builder#setResultGrouping` was not called.

Returns
`int` | Value is either `0` or a combination of `GROUPING_TYPE_PER_PACKAGE`, and `GROUPING_TYPE_PER_NAMESPACE`

### getSnippetCount

    public int getSnippetCount ()

Returns how many documents to generate snippets for.

Returns
`int` |

### getSnippetCountPerProperty

    public int getSnippetCountPerProperty ()

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

Returns
`int` |

### getTermMatch

    public int getTermMatch ()

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

Returns
`int` | Value is `TERM_MATCH_EXACT_ONLY`, or `TERM_MATCH_PREFIX`

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*