SearchResult.Builder
class SearchResult.Builder
Builder for SearchResult objects.
Summary
Public constructors |
|---|
|
Constructs a new builder for |
Public functions |
|
|---|---|
SearchResult.Builder |
addInformationalRankingSignal(rankingSignal: Double)Adds the informational ranking signal of the matched document in this SearchResult. |
SearchResult.Builder |
addJoinedResult(joinedResult: SearchResult)Adds a |
SearchResult.Builder |
addMatchInfo(matchInfo: SearchResult.MatchInfo)Adds another match to this SearchResult. |
SearchResult |
build()Constructs a new |
SearchResult.Builder |
setDocument(document: Any)Sets the document which matched. |
SearchResult.Builder |
setGenericDocument(document: GenericDocument)Sets the document which matched. |
SearchResult.Builder |
@ExperimentalAppSearchApiSets the map from schema type names to the list of their parent types. |
SearchResult.Builder |
setRankingSignal(rankingSignal: Double)Sets the ranking signal of the matched document in this SearchResult. |
Public constructors
Public functions
addInformationalRankingSignal
fun addInformationalRankingSignal(rankingSignal: Double): SearchResult.Builder
Adds the informational ranking signal of the matched document in this SearchResult.
addJoinedResult
fun addJoinedResult(joinedResult: SearchResult): SearchResult.Builder
Adds a SearchResult that was joined by the JoinSpec.
| Parameters | |
|---|---|
joinedResult: SearchResult |
The joined SearchResult to add. |
addMatchInfo
fun addMatchInfo(matchInfo: SearchResult.MatchInfo): SearchResult.Builder
Adds another match to this SearchResult.
setDocument
fun setDocument(document: Any): SearchResult.Builder
Sets the document which matched.
| Parameters | |
|---|---|
document: Any |
An instance of a class annotated with |
| Throws | |
|---|---|
androidx.appsearch.exceptions.AppSearchException |
if an error occurs converting a document class into a |
setGenericDocument
fun setGenericDocument(document: GenericDocument): SearchResult.Builder
Sets the document which matched.
setParentTypeMap
@ExperimentalAppSearchApi
fun setParentTypeMap(
parentTypeMap: (Mutable)Map<String!, (Mutable)List<String!>!>
): SearchResult.Builder
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
fun setRankingSignal(rankingSignal: Double): SearchResult.Builder
Sets the ranking signal of the matched document in this SearchResult.