MatchInfo
class MatchInfo : Parcelable
| kotlin.Any | |
| ↳ | android.app.appsearch.SearchResult.MatchInfo |
This class represents match objects for any snippets that might be present in SearchResults from a query.
A MatchInfo contains either a TextMatchInfo representing a text match snippet, or an EmbeddingMatchInfo representing an embedding match snippet.
Summary
| Nested classes | |
|---|---|
|
Builder for |
|
| Inherited constants | |
|---|---|
| Public methods | |
|---|---|
| SearchResult.EmbeddingMatchInfo? |
Retrieves the embedding-based match information. |
| CharSequence |
Gets the exact term of the given entry that matched the query. |
| SearchResult.MatchRange |
Gets the |
| String |
Gets the full text corresponding to the given entry. |
| String |
Gets the property path corresponding to the given entry. |
| PropertyPath |
Gets a |
| CharSequence |
Gets the snippet corresponding to the given entry. |
| SearchResult.MatchRange |
Gets the snippet |
| CharSequence |
Gets the exact term subsequence of the given entry that matched the query. |
| SearchResult.MatchRange |
Gets the |
| SearchResult.TextMatchInfo? |
Retrieves the text-based match information. |
| Unit |
writeToParcel(dest: Parcel, flags: Int)Flatten this object in to a Parcel. |
| Properties | |
|---|---|
| static Parcelable.Creator<SearchResult.MatchInfo!> | |
Public methods
getEmbeddingMatch
fun getEmbeddingMatch(): SearchResult.EmbeddingMatchInfo?
Retrieves the embedding-based match information. Only populated when android.app.appsearch.SearchSpec#shouldRetrieveEmbeddingMatchInfos() is true.
| Return | |
|---|---|
SearchResult.EmbeddingMatchInfo? |
A EmbeddingMatchInfo instance, or null if the match is not an embedding match. |
getExactMatch
fun getExactMatch(): CharSequence
Gets the exact term of the given entry that matched the query. Returns an empty CharSequence if the match is not text-based.
| Return | |
|---|---|
CharSequence |
This value cannot be null. |
getExactMatchRange
fun getExactMatchRange(): SearchResult.MatchRange
Gets the MatchRange of the exact term of the given entry that matched the query. Returns [0, 0] if the match is not text-based.
| Return | |
|---|---|
SearchResult.MatchRange |
This value cannot be null. |
getFullText
fun getFullText(): String
Gets the full text corresponding to the given entry. Returns an empty string if the match is not text-based.
| Return | |
|---|---|
String |
This value cannot be null. |
getPropertyPath
fun getPropertyPath(): String
Gets the property path corresponding to the given entry.
A property path is a '.' - delimited sequence of property names indicating which property in the document these snippets correspond to.
Example properties: 'body', 'sender.name', 'sender.emailaddress', etc. For class example 1 this returns "subject"
| Return | |
|---|---|
String |
This value cannot be null. |
getPropertyPathObject
fun getPropertyPathObject(): PropertyPath
Gets a PropertyPath object representing the property path corresponding to the given entry.
Methods such as GenericDocument.getPropertyDocument accept a path as a string rather than a PropertyPath object. However, you may want to manipulate the path before getting a property document. This method returns a PropertyPath rather than a String for easier path manipulation, which can then be converted to a String.
| Return | |
|---|---|
PropertyPath |
This value cannot be null. |
getSnippet
fun getSnippet(): CharSequence
Gets the snippet corresponding to the given entry. Returns an empty CharSequence if the match is not text-based.
Snippet - Provides a subset of the content to display. Only populated when requested maxSnippetSize > 0. The size of this content can be changed by android.app.appsearch.SearchSpec.Builder#setMaxSnippetSize. Windowing is centered around the middle of the matched token with content on either side clipped to token boundaries.
| Return | |
|---|---|
CharSequence |
This value cannot be null. |
getSnippetRange
fun getSnippetRange(): SearchResult.MatchRange
Gets the snippet MatchRange corresponding to the given entry. Returns [0,0] if the match is not text-based.
Only populated when set maxSnippetSize > 0 in android.app.appsearch.SearchSpec.Builder#setMaxSnippetSize.
| Return | |
|---|---|
SearchResult.MatchRange |
This value cannot be null. |
getSubmatch
fun getSubmatch(): CharSequence
Gets the exact term subsequence of the given entry that matched the query. Returns an empty CharSequence if the match is not text-based.
| Return | |
|---|---|
CharSequence |
This value cannot be null. |
getSubmatchRange
fun getSubmatchRange(): SearchResult.MatchRange
Gets the MatchRange of the submatch term subsequence of the given entry that matched the query. Returns [0, 0] if the match is not text-based.
| Return | |
|---|---|
SearchResult.MatchRange |
This value cannot be null. |
getTextMatch
fun getTextMatch(): SearchResult.TextMatchInfo?
Retrieves the text-based match information.
| Return | |
|---|---|
SearchResult.TextMatchInfo? |
A TextMatchInfo instance, or null if the match is not text-based. |
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
dest |
Parcel: This value cannot be null. |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
Properties
CREATOR
static val CREATOR: Parcelable.Creator<SearchResult.MatchInfo!>