SearcherOptions.Builder

public static abstract class SearcherOptions.Builder

Builder for SearcherOptions.

Public Constructors

Public Methods

abstract SearcherOptions
build()
abstract SearcherOptions.Builder
setIndexFile(File indexFile)
Sets the index file to search into.
abstract SearcherOptions.Builder
setL2Normalize(boolean l2Normalize)
Sets whether to normalize the embedding feature vector with L2 norm.
abstract SearcherOptions.Builder
setMaxResults(int maxResults)
Sets the maximum number of nearest neighbor results to return.
abstract SearcherOptions.Builder
setQuantize(boolean quantize)
Sets whether the embedding should be quantized to bytes via scalar quantization.

Inherited Methods

Public Constructors

public Builder ()

Public Methods

public abstract SearcherOptions build ()

public abstract SearcherOptions.Builder setIndexFile (File indexFile)

Sets the index file to search into.

Required if the model does not come with an index file inside. Otherwise, it can be ignore by setting to null.

Parameters
indexFile

public abstract SearcherOptions.Builder setL2Normalize (boolean l2Normalize)

Sets whether to normalize the embedding feature vector with L2 norm. Defaults to false.

Use this option only if the model does not already contain a native L2_NORMALIZATION TFLite Op. In most cases, this is already the case and L2 norm is thus achieved through TFLite inference.

Parameters
l2Normalize

public abstract SearcherOptions.Builder setMaxResults (int maxResults)

Sets the maximum number of nearest neighbor results to return. Defaults to 5

Parameters
maxResults

public abstract SearcherOptions.Builder setQuantize (boolean quantize)

Sets whether the embedding should be quantized to bytes via scalar quantization. Defaults to false.

Embeddings are implicitly assumed to be unit-norm and therefore any dimension is guaranteed to have a value in [-1.0, 1.0]. Use the l2_normalize option if this is not the case.

Parameters
quantize