Interface SearchOperations

All Known Subinterfaces:
MeilisearchOperations
All Known Implementing Classes:
MeilisearchTemplate

public interface SearchOperations
The operations for the below Meilisearch APIs.
  • Method Details

    • count

      long count(Class<?> clazz)
      Returns the number of entities available.
      Parameters:
      clazz - the entity class, must be annotated with Document
      Returns:
      the number of entities
    • search

      <T, Q extends BaseQuery> SearchHits<T> search(Q query, Class<T> clazz)
      Search for entities that meet the criteria using Spring Data style query. Note that by default, MaxTotalHits in Pagination is 1000. If you want to change the value, you can use Setting.
      Type Parameters:
      T - the type of the entity
      Q - the type of query extending BaseQuery
      Parameters:
      query - the Spring Data style query supporting Pageable, Sort, etc.
      clazz - the entity class, must be annotated with Document
      Returns:
      the entities found by the query
    • multiSearch

      <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. This method allows you to perform multiple search queries in a single HTTP request, When using IndexQuery, you can search across multiple indexes simultaneously.
      Type Parameters:
      T - the type of the entity
      Q - the type of query extending BaseQuery. When using IndexQuery, multi-index search is available
      Parameters:
      queries - the list of queries to execute. Each query can target different indexes and have different search parameters
      clazz - the entity class, must be annotated with Document
      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 entity
      Q - the type of query extending BaseQuery. When using IndexQuery, multi-index search is available
      Parameters:
      queries - the list of queries to execute. Each query can target different indexes and have different search parameters
      federation - the federation configuration that defines how to combine results from multiple indexes
      clazz - the entity class, must be annotated with Document
      Returns:
      the list of entities found by the queries, combined according to the federation strategy
    • facetSearch

      SearchHits<FacetHit> facetSearch(FacetQuery query, Class<?> clazz)
      Execute the facet search query against meilisearch and return the result.
      Parameters:
      query - the facet query to execute
      clazz - the entity class, must be annotated with Document
      Returns:
      the list of entities found by the query
    • similarSearch

      <T> SearchHits<T> similarSearch(SimilarQuery query, Class<T> clazz)
      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 embedder
      clazz - the entity class, must be annotated with Document
      Returns:
      the list of similar entities found by the query