# Print output for @column tags ?>
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.
Nested classes | |
---|---|
class |
SearchSpec.Builder
Builder for |
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 |
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 |
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 | |
---|---|
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)
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)
public static final int ORDER_ASCENDING
Search results will be returned in an ascending order.
Constant Value: 1 (0x00000001)
public static final int ORDER_DESCENDING
Search results will be returned in a descending order.
Constant Value: 0 (0x00000000)
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: "*"
public static final int RANKING_STRATEGY_CREATION_TIMESTAMP
Ranked by document creation timestamps.
Constant Value: 2 (0x00000002)
public static final int RANKING_STRATEGY_DOCUMENT_SCORE
Ranked by app-provided document scores.
Constant Value: 1 (0x00000001)
public static final int RANKING_STRATEGY_NONE
No Ranking, results are returned in arbitrary order.
Constant Value: 0 (0x00000000)
public static final int RANKING_STRATEGY_RELEVANCE_SCORE
Ranked by document relevance score.
Constant Value: 3 (0x00000003)
public static final int RANKING_STRATEGY_SYSTEM_USAGE_COUNT
Ranked by number of usages from a system UI surface.
Constant Value: 6 (0x00000006)
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)
public static final int RANKING_STRATEGY_USAGE_COUNT
Ranked by number of usages, as reported by the app.
Constant Value: 4 (0x00000004)
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)
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)
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 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 . |
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 . |
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 . |
public int getMaxSnippetSize ()
Returns the maximum size of a snippet in characters.
Returns | |
---|---|
int |
public int getOrder ()
Returns the order of returned search results (descending or ascending).
Returns | |
---|---|
int |
Value is ORDER_DESCENDING , or ORDER_ASCENDING |
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 . |
public int getRankingStrategy ()
Returns the ranking strategy.
public int getResultCountPerPage ()
Returns the number of results per page in the result set.
Returns | |
---|---|
int |
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. |
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 |
public int getSnippetCount ()
Returns how many documents to generate snippets for.
Returns | |
---|---|
int |
public int getSnippetCountPerProperty ()
Returns how many matches for each property of a matching document to generate snippets for.
Returns | |
---|---|
int |
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 |