SearchResult.Builder


class SearchResult.Builder


Builder for SearchResult objects.

Summary

Public constructors

Builder(packageName: String, databaseName: String)

Constructs a new builder for SearchResult objects.

Public functions

SearchResult.Builder

Adds the informational ranking signal of the matched document in this SearchResult.

SearchResult.Builder

Adds a SearchResult that was joined by the JoinSpec.

SearchResult.Builder

Adds another match to this SearchResult.

SearchResult

Constructs a new SearchResult.

SearchResult.Builder
setDocument(document: Any)

Sets the document which matched.

SearchResult.Builder

Sets the document which matched.

SearchResult.Builder
setRankingSignal(rankingSignal: Double)

Sets the ranking signal of the matched document in this SearchResult.

Public constructors

Builder

Added in 1.1.0-alpha06
Builder(packageName: String, databaseName: String)

Constructs a new builder for SearchResult objects.

Parameters
packageName: String

the package name the matched document belongs to

databaseName: String

the database name the matched document belongs to.

Public functions

addInformationalRankingSignal

Added in 1.1.0-alpha06
fun addInformationalRankingSignal(rankingSignal: Double): SearchResult.Builder

Adds the informational ranking signal of the matched document in this SearchResult.

addJoinedResult

Added in 1.1.0-alpha06
fun addJoinedResult(joinedResult: SearchResult): SearchResult.Builder

Adds a SearchResult that was joined by the JoinSpec.

Parameters
joinedResult: SearchResult

The joined SearchResult to add.

addMatchInfo

Added in 1.1.0-alpha06
fun addMatchInfo(matchInfo: SearchResult.MatchInfo): SearchResult.Builder

Adds another match to this SearchResult.

build

Added in 1.1.0-alpha06
fun build(): SearchResult

Constructs a new SearchResult.

setDocument

Added in 1.1.0-alpha06
fun setDocument(document: Any): SearchResult.Builder

Sets the document which matched.

Parameters
document: Any

An instance of a class annotated with androidx.appsearch.annotation.Document.

Throws
androidx.appsearch.exceptions.AppSearchException

if an error occurs converting a document class into a GenericDocument.

setGenericDocument

Added in 1.1.0-alpha06
fun setGenericDocument(document: GenericDocument): SearchResult.Builder

Sets the document which matched.

setRankingSignal

Added in 1.1.0-alpha06
fun setRankingSignal(rankingSignal: Double): SearchResult.Builder

Sets the ranking signal of the matched document in this SearchResult.