SearchResult.Builder
public final class SearchResult.Builder
Builder for SearchResult objects.
Summary
Public constructors |
|---|
|
Constructs a new builder for |
Public methods |
|
|---|---|
@NonNull SearchResult.Builder |
addInformationalRankingSignal(double rankingSignal)Adds the informational ranking signal of the matched document in this SearchResult. |
@NonNull SearchResult.Builder |
addJoinedResult(@NonNull SearchResult joinedResult)Adds a |
@NonNull SearchResult.Builder |
addMatchInfo(@NonNull SearchResult.MatchInfo matchInfo)Adds another match to this SearchResult. |
@NonNull SearchResult |
build()Constructs a new |
@NonNull SearchResult.Builder |
setDocument(@NonNull Object document)Sets the document which matched. |
@NonNull SearchResult.Builder |
setGenericDocument(@NonNull GenericDocument document)Sets the document which matched. |
@NonNull SearchResult.Builder |
@ExperimentalAppSearchApiSets the map from schema type names to the list of their parent types. |
@NonNull SearchResult.Builder |
setRankingSignal(double rankingSignal)Sets the ranking signal of the matched document in this SearchResult. |
Public constructors
Public methods
addInformationalRankingSignal
public @NonNull SearchResult.Builder addInformationalRankingSignal(double rankingSignal)
Adds the informational ranking signal of the matched document in this SearchResult.
addJoinedResult
public @NonNull SearchResult.Builder addJoinedResult(@NonNull SearchResult joinedResult)
Adds a SearchResult that was joined by the JoinSpec.
| Parameters | |
|---|---|
@NonNull SearchResult joinedResult |
The joined SearchResult to add. |
addMatchInfo
public @NonNull SearchResult.Builder addMatchInfo(@NonNull SearchResult.MatchInfo matchInfo)
Adds another match to this SearchResult.
setDocument
public @NonNull SearchResult.Builder setDocument(@NonNull Object document)
Sets the document which matched.
| Parameters | |
|---|---|
@NonNull Object document |
An instance of a class annotated with |
| Throws | |
|---|---|
androidx.appsearch.exceptions.AppSearchException |
if an error occurs converting a document class into a |
setGenericDocument
public @NonNull SearchResult.Builder setGenericDocument(@NonNull GenericDocument document)
Sets the document which matched.
setParentTypeMap
@ExperimentalAppSearchApi
public @NonNull SearchResult.Builder setParentTypeMap(@NonNull Map<String, List<String>> parentTypeMap)
Sets the map from schema type names to the list of their parent types.
The map should include entries for the GenericDocument's own type and all of the nested documents' types.
Child types must appear before parent types in each list. Otherwise, the toDocumentClass method may not correctly identify the most concrete type. This could lead to unintended deserialization into a more general type instead of a more specific type.
Parent types should include transitive parents.
setRankingSignal
public @NonNull SearchResult.Builder setRankingSignal(double rankingSignal)
Sets the ranking signal of the matched document in this SearchResult.