SearchResult.Builder


public final class SearchResult.Builder


Builder for SearchResult objects.

Summary

Public constructors

Builder(@NonNull String packageName, @NonNull String databaseName)

Constructs a new builder for SearchResult objects.

Public methods

@NonNull SearchResult.Builder
addInformationalRankingSignal(double rankingSignal)

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

@NonNull SearchResult.Builder

Adds a SearchResult that was joined by the JoinSpec.

@NonNull SearchResult.Builder

Adds another match to this SearchResult.

@NonNull SearchResult

Constructs a new SearchResult.

@NonNull SearchResult.Builder

Sets the document which matched.

@NonNull SearchResult.Builder

Sets the document which matched.

@NonNull SearchResult.Builder
setRankingSignal(double rankingSignal)

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

Public constructors

Builder

Added in 1.1.0-alpha06
public Builder(@NonNull String packageName, @NonNull String databaseName)

Constructs a new builder for SearchResult objects.

Parameters
@NonNull String packageName

the package name the matched document belongs to

@NonNull String databaseName

the database name the matched document belongs to.

Public methods

addInformationalRankingSignal

Added in 1.1.0-alpha06
public @NonNull SearchResult.Builder addInformationalRankingSignal(double rankingSignal)

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

addJoinedResult

Added in 1.1.0-alpha06
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

Added in 1.1.0-alpha06
public @NonNull SearchResult.Builder addMatchInfo(@NonNull SearchResult.MatchInfo matchInfo)

Adds another match to this SearchResult.

build

Added in 1.1.0-alpha06
public @NonNull SearchResult build()

Constructs a new SearchResult.

setDocument

Added in 1.1.0-alpha06
public @NonNull SearchResult.Builder setDocument(@NonNull Object document)

Sets the document which matched.

Parameters
@NonNull Object document

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
public @NonNull SearchResult.Builder setGenericDocument(@NonNull GenericDocument document)

Sets the document which matched.

setRankingSignal

Added in 1.1.0-alpha06
public @NonNull SearchResult.Builder setRankingSignal(double rankingSignal)

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