SearchResult.Builder

public static final class SearchResult.Builder
extends Object

java.lang.Object
   ↳ androidx.appsearch.app.SearchResult.Builder


Builder for SearchResult objects.

Summary

Public constructors

Builder(String packageName, String databaseName)

Constructs a new builder for SearchResult objects.

Public methods

SearchResult.Builder addMatchInfo(SearchResult.MatchInfo matchInfo)

Adds another match to this SearchResult.

SearchResult build()

Constructs a new SearchResult.

SearchResult.Builder setDocument(Object document)

Sets the document which matched.

SearchResult.Builder setGenericDocument(GenericDocument document)

Sets the document which matched.

SearchResult.Builder setRankingSignal(double rankingSignal)

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

Inherited methods

Public constructors

Builder

public Builder (String packageName, 
                String databaseName)

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 methods

addMatchInfo

public SearchResult.Builder addMatchInfo (SearchResult.MatchInfo matchInfo)

Adds another match to this SearchResult.

Parameters
matchInfo SearchResult.MatchInfo

Returns
SearchResult.Builder

build

public SearchResult build ()

Constructs a new SearchResult.

Returns
SearchResult

setDocument

public SearchResult.Builder setDocument (Object document)

Sets the document which matched.

Parameters
document Object: An instance of a class annotated with Document.

Returns
SearchResult.Builder

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

setGenericDocument

public SearchResult.Builder setGenericDocument (GenericDocument document)

Sets the document which matched.

Parameters
document GenericDocument

Returns
SearchResult.Builder

setRankingSignal

public SearchResult.Builder setRankingSignal (double rankingSignal)

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

Parameters
rankingSignal double

Returns
SearchResult.Builder