Skip to content

v0.15.0 ๐Ÿš‚

Choose a tag to compare

@meili-bot meili-bot released this 25 Mar 20:23
· 23 commits to refs/heads/main since this release
a35652c

โš ๏ธ Breaking changes

  • Rename top-level module MeiliSearch to Meilisearch (#384) @ellnix
    We are now consistent with other usage of Meilisearch. Here is a convenient one-liner to move to the new spelling:
    find . -type f -exec sed -i 's/MeiliSearch/Meilisearch/g' {} \; 
    Using the old spelling is still functional, but will throw a warning for the time being.

๐Ÿš€ Enhancements

  • Support scopes in multi_search (#405) @ellnix
    You can now apply ActiveRecord scopes to multi_search:
    multi_search_results = Meilisearch::Rails.multi_search(
      # scope may be a relation
      'books' => { q: 'Harry', scope: Book.where("year < 2005") },
      # or a model
      'mangas' => { q: 'Attack', scope: Manga }
    )
    With this change, the :class_name option has been deprecated (since :scope achieves the same outcome), using it will cause a warning to be logged.
  • Add federated search (#393) @ellnix
    This gem now supports federated search! Federated search is similar to multi-search, except the results are a single array sorted by ranking rules:
    results = Meilisearch::Rails.federated_search(
      queries: [
        { q: 'Harry', scope: Book.all },
        { q: 'Attack on Titan', scope: Manga.all }
      ]
    )
    <ul>
      <% results.each do |record| %>
        <li><%= record.title %></li>
      <% end %>
    </ul>
    
    
    <ul>
      <!-- Attack on Titan appears first even though it was specified second, 
           it's ranked higher because it's a closer match -->
      <li>Attack on Titan</li>
      <li>Harry Potter and the Philosopher's Stone</li>
      <li>Harry Potter and the Chamber of Secrets</li>
    </ul>
    Learn more in the README.

Thanks again to @ellnix! ๐ŸŽ‰