Interface SearchOperations
- All Known Subinterfaces:
MeilisearchOperations
- All Known Implementing Classes:
MeilisearchTemplate
public interface SearchOperations
The operations for the below Meilisearch APIs.
-
Method Summary
Modifier and TypeMethodDescriptionlongReturns the number of entities available.facetSearch(FacetQuery query, Class<?> clazz) Execute the facet search query against meilisearch and return the result.<T,Q extends BaseQuery>
SearchHits<T>multiSearch(List<Q> queries, com.meilisearch.sdk.MultiSearchFederation federation, Class<T> clazz) Execute federated multi-search query against Meilisearch and return the result.<T,Q extends BaseQuery>
SearchHits<T>multiSearch(List<Q> queries, Class<T> clazz) Execute non-federated multi-search query against Meilisearch and return the result.<T,Q extends BaseQuery>
SearchHits<T>Search for entities that meet the criteria using Spring Data style query.<T> SearchHits<T>similarSearch(SimilarQuery query, Class<T> clazz) Execute the similar documents search query against meilisearch and return the result.
-
Method Details
-
count
Returns the number of entities available.- Parameters:
clazz- the entity class, must be annotated withDocument- Returns:
- the number of entities
-
search
Search for entities that meet the criteria using Spring Data style query. Note that by default, MaxTotalHits inPaginationis 1000. If you want to change the value, you can useSetting.- Type Parameters:
T- the type of the entityQ- the type of query extending BaseQuery- Parameters:
query- the Spring Data style query supporting Pageable, Sort, etc.clazz- the entity class, must be annotated withDocument- Returns:
- the entities found by the query
-
multiSearch
Execute non-federated multi-search query against Meilisearch and return the result. This method allows you to perform multiple search queries in a single HTTP request, When usingIndexQuery, you can search across multiple indexes simultaneously.- Type Parameters:
T- the type of the entityQ- the type of query extending BaseQuery. When usingIndexQuery, multi-index search is available- Parameters:
queries- the list of queries to execute. Each query can target different indexes and have different search parametersclazz- the entity class, must be annotated withDocument- Returns:
- the list of entities found by the queries
-
multiSearch
<T,Q extends BaseQuery> SearchHits<T> multiSearch(List<Q> queries, com.meilisearch.sdk.MultiSearchFederation federation, Class<T> clazz) Execute federated multi-search query against Meilisearch and return the result. Federated search allows you to combine and process results from multiple indexes using different strategies like merging or joining the results. But the pageable option in query is not supported in federated multi-search.- Type Parameters:
T- the type of the entityQ- the type of query extending BaseQuery. When usingIndexQuery, multi-index search is available- Parameters:
queries- the list of queries to execute. Each query can target different indexes and have different search parametersfederation- the federation configuration that defines how to combine results from multiple indexesclazz- the entity class, must be annotated withDocument- Returns:
- the list of entities found by the queries, combined according to the federation strategy
-
facetSearch
Execute the facet search query against meilisearch and return the result.- Parameters:
query- the facet query to executeclazz- the entity class, must be annotated withDocument- Returns:
- the list of entities found by the query
-
similarSearch
Execute the similar documents search query against meilisearch and return the result. This method performs AI-powered semantic search to find documents similar to the given document.- Type Parameters:
T- the type of the entity- Parameters:
query- the similar query to execute, containing the document ID and embedderclazz- the entity class, must be annotated withDocument- Returns:
- the list of similar entities found by the query
-