Class SearchRequest
java.lang.Object
org.springframework.ai.vectorstore.SearchRequest
Similarity search request. Use the
builder()
to create the
instance of a SearchRequest
.- Author:
- Christian Tzolov, Thomas Vitale, Ilayaperumal Gopinathan
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Default value for the top 'k' similar results to return.static final double
Similarity threshold that accepts all search scores. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic SearchRequest.Builder
builder()
Builder for creating the SearchRequest instance.static SearchRequest.Builder
defaults()
Deprecated, for removal: This API element is subject to removal in a future version.boolean
static SearchRequest.Builder
from
(SearchRequest originalSearchRequest) Copy an existingSearchRequest.Builder
instance.getQuery()
double
int
getTopK()
boolean
int
hashCode()
static SearchRequest
Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.query(String)
instead.toString()
withFilterExpression
(String textExpression) Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.filterExpression(String)
instead.withFilterExpression
(Filter.Expression expression) Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.query(String)
instead.withSimilarityThreshold
(double threshold) Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.similarityThreshold(double)
instead.Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.similarityThresholdAll()
instead.withTopK
(int topK) Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.topK(int)
instead.
-
Field Details
-
SIMILARITY_THRESHOLD_ACCEPT_ALL
public static final double SIMILARITY_THRESHOLD_ACCEPT_ALLSimilarity threshold that accepts all search scores. A threshold value of 0.0 means any similarity is accepted or disable the similarity threshold filtering. A threshold value of 1.0 means an exact match is required.- See Also:
-
DEFAULT_TOP_K
public static final int DEFAULT_TOP_KDefault value for the top 'k' similar results to return.- See Also:
-
-
Constructor Details
-
SearchRequest
public SearchRequest()
-
-
Method Details
-
from
Copy an existingSearchRequest.Builder
instance.- Parameters:
originalSearchRequest
-SearchRequest
instance to copy.- Returns:
- Returns new
SearchRequest.Builder
instance.
-
query
Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.query(String)
instead. -
defaults
Deprecated, for removal: This API element is subject to removal in a future version.usebuilder()
instead.Create a newSearchRequest
builder instance with an empty embedding query string. Use theSearchRequest.Builder.query(String query)
to set/update the embedding query text.- Returns:
- Returns new
SearchRequest
builder instance.
-
builder
Builder for creating the SearchRequest instance.- Returns:
- the builder.
-
withQuery
Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.query(String)
instead. -
withTopK
Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.topK(int)
instead. -
withSimilarityThreshold
@Deprecated(forRemoval=true, since="1.0.0-M5") public SearchRequest withSimilarityThreshold(double threshold) Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.similarityThreshold(double)
instead. -
withSimilarityThresholdAll
Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.similarityThresholdAll()
instead. -
withFilterExpression
@Deprecated(forRemoval=true, since="1.0.0-M5") public SearchRequest withFilterExpression(@Nullable Filter.Expression expression) Deprecated, for removal: This API element is subject to removal in a future version. -
withFilterExpression
@Deprecated(forRemoval=true, since="1.0.0-M5") public SearchRequest withFilterExpression(@Nullable String textExpression) Deprecated, for removal: This API element is subject to removal in a future version.useSearchRequest.Builder.filterExpression(String)
instead. -
getQuery
-
getTopK
public int getTopK() -
getSimilarityThreshold
public double getSimilarityThreshold() -
getFilterExpression
-
hasFilterExpression
public boolean hasFilterExpression() -
toString
-
equals
-
hashCode
public int hashCode()
-
builder()
instead.