SearchSuggestionSpec.Builder


public final class SearchSuggestionSpec.Builder


Builder for objects.

Summary

Public constructors

Builder(@IntRange(from = 1) int maximumResultCount)

Creates an SearchSuggestionSpec.Builder object.

Public methods

@NonNull SearchSuggestionSpec.Builder
addFilterDocumentClasses(@NonNull Class[] documentClasses)

Adds a schema filter to SearchSuggestionSpec Entry.

@NonNull SearchSuggestionSpec.Builder

Adds the Schema names of given document classes to the Schema type filter of SearchSuggestionSpec Entry.

@NonNull SearchSuggestionSpec.Builder
addFilterDocumentIds(
    @NonNull String namespace,
    @NonNull String[] documentIds
)

Adds a document ID filter to SearchSuggestionSpec Entry.

@NonNull SearchSuggestionSpec.Builder
addFilterDocumentIds(
    @NonNull String namespace,
    @NonNull Collection<String> documentIds
)

Adds a document ID filter to SearchSuggestionSpec Entry.

@NonNull SearchSuggestionSpec.Builder
addFilterNamespaces(@NonNull String[] namespaces)

Adds a namespace filter to SearchSuggestionSpec Entry.

@NonNull SearchSuggestionSpec.Builder

Adds a namespace filter to SearchSuggestionSpec Entry.

@NonNull SearchSuggestionSpec.Builder
addFilterSchemas(@NonNull String[] schemaTypes)

Adds a schema filter to SearchSuggestionSpec Entry.

@NonNull SearchSuggestionSpec.Builder

Adds a schema filter to SearchSuggestionSpec Entry.

@NonNull SearchSuggestionSpec

Constructs a new SearchSpec from the contents of this builder.

@NonNull SearchSuggestionSpec.Builder
setRankingStrategy(int rankingStrategy)

Sets ranking strategy for suggestion results.

Public constructors

Builder

Added in 1.1.0-alpha04
public Builder(@IntRange(from = 1) int maximumResultCount)

Creates an SearchSuggestionSpec.Builder object.

Parameters
@IntRange(from = 1) int maximumResultCount

Sets the maximum number of suggestion in the returned object.

Public methods

addFilterDocumentClasses

public @NonNull SearchSuggestionSpec.Builder addFilterDocumentClasses(@NonNull Class[] documentClasses)

Adds a schema filter to SearchSuggestionSpec Entry. Only search for suggestions that has documents under the specified schema.

If unset, the query will search over all schema.

Merged list available from getFilterSchemas.

Parameters
@NonNull Class[] documentClasses

classes annotated with Document.

addFilterDocumentClasses

Added in 1.1.0-alpha04
public @NonNull SearchSuggestionSpec.Builder addFilterDocumentClasses(
    @NonNull Collection<Class<Object>> documentClasses
)

Adds the Schema names of given document classes to the Schema type filter of SearchSuggestionSpec Entry. Only search for suggestions that has documents under the specified schema.

If unset, the query will search over all schema.

Merged list available from getFilterSchemas.

Parameters
@NonNull Collection<Class<Object>> documentClasses

classes annotated with Document.

addFilterDocumentIds

public @NonNull SearchSuggestionSpec.Builder addFilterDocumentIds(
    @NonNull String namespace,
    @NonNull String[] documentIds
)

Adds a document ID filter to SearchSuggestionSpec Entry. Only search for suggestions in the given specified documents.

If unset, the query will search over all documents.

addFilterDocumentIds

Added in 1.1.0-alpha04
public @NonNull SearchSuggestionSpec.Builder addFilterDocumentIds(
    @NonNull String namespace,
    @NonNull Collection<String> documentIds
)

Adds a document ID filter to SearchSuggestionSpec Entry. Only search for suggestions in the given specified documents.

If unset, the query will search over all documents.

addFilterNamespaces

public @NonNull SearchSuggestionSpec.Builder addFilterNamespaces(@NonNull String[] namespaces)

Adds a namespace filter to SearchSuggestionSpec Entry. Only search for suggestions that has documents under the specified namespaces.

If unset, the query will search over all namespaces.

addFilterNamespaces

Added in 1.1.0-alpha04
public @NonNull SearchSuggestionSpec.Builder addFilterNamespaces(@NonNull Collection<String> namespaces)

Adds a namespace filter to SearchSuggestionSpec Entry. Only search for suggestions that has documents under the specified namespaces.

If unset, the query will search over all namespaces.

addFilterSchemas

public @NonNull SearchSuggestionSpec.Builder addFilterSchemas(@NonNull String[] schemaTypes)

Adds a schema filter to SearchSuggestionSpec Entry. Only search for suggestions that has documents under the specified schema.

If unset, the query will search over all schema.

addFilterSchemas

Added in 1.1.0-alpha04
public @NonNull SearchSuggestionSpec.Builder addFilterSchemas(@NonNull Collection<String> schemaTypes)

Adds a schema filter to SearchSuggestionSpec Entry. Only search for suggestions that has documents under the specified schema.

If unset, the query will search over all schema.

build

Added in 1.1.0-alpha04
public @NonNull SearchSuggestionSpec build()

Constructs a new SearchSpec from the contents of this builder.

setRankingStrategy

Added in 1.1.0-alpha04
public @NonNull SearchSuggestionSpec.Builder setRankingStrategy(int rankingStrategy)

Sets ranking strategy for suggestion results.

The default value SUGGESTION_RANKING_STRATEGY_DOCUMENT_COUNT will be used if this method is never called.