Skip to content

Conversation

@Nymuxyzo
Copy link
Contributor

@Nymuxyzo Nymuxyzo commented May 31, 2025

Pull Request

Related issue

Fixes #628

What does this PR do?

  • Add the ability to fetch documents by Ids

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Summary by CodeRabbit

  • New Features
    • Support for retrieving documents by specifying an array of document IDs.
  • Documentation
    • Updated method docs to describe the new IDs option.
  • Tests
    • Added tests verifying retrieval by IDs, limits with IDs, and combining IDs with filters.
  • Chores
    • Added gem metadata linking to source code and bug tracker.

@coderabbitai
Copy link

coderabbitai bot commented May 31, 2025

Walkthrough

The Meilisearch::Index#documents method now accepts an :ids array option to fetch specific documents; requests include ids in POST /documents/fetch when :filter is present or as query params on GET /documents otherwise. Tests and gemspec metadata were added.

Changes

Cohort / File(s) Change Summary
Index method
lib/meilisearch/index.rb
Added support for :ids option in documents(options = {}); includes ids in POST body for /documents/fetch when :filter is present and as query params for GET /documents when not. Documentation updated.
Specs
spec/meilisearch/index/documents_spec.rb
Added tests verifying retrieval by ids, behavior with limit, and combination of ids with filter.
Gemspec metadata
meilisearch.gemspec
Added source_code_uri and bug_tracker_uri metadata entries.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Index as Meilisearch::Index
    participant Server as Meilisearch Server

    User->>Index: documents(ids: [...], filter: opt, limit: opt)
    alt filter present
        Note right of Index: Build POST body { filter, ids, limit }
        Index->>Server: POST /indexes/:uid/documents/fetch
    else no filter
        Note right of Index: Build query ?ids=...&limit=...
        Index->>Server: GET /indexes/:uid/documents
    end
    Server-->>Index: 200 OK (documents, total)
    Index-->>User: return documents object
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Update method to allow retrieving documents by IDs (#628)

Out-of-scope changes

Code Change Explanation
Added gem metadata (source_code_uri, bug_tracker_uri) (meilisearch.gemspec) This metadata addition is repository packaging/metadata only and is not required by the #628 objective to enable fetching documents by IDs.

"I dug through indexes, small and wide,
Collected the IDs that you supplied.
With hops and tests and a tidy spec,
The Meili burrow finds each doc direct.
🐇✨"

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented May 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (78f93e6) to head (85a9f07).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #632   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          806       806           
=========================================
  Hits           806       806           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Nymuxyzo Nymuxyzo force-pushed the feat/documents_by_ids branch from fefe5ed to cb0fab8 Compare June 10, 2025 22:05
@Nymuxyzo Nymuxyzo force-pushed the feat/documents_by_ids branch from cb0fab8 to 85a9f07 Compare August 24, 2025 18:38
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
meilisearch.gemspec (1)

21-22: Optional: Add documentation and changelog URIs for a richer gem page.

Consider adding documentation_uri and changelog_uri so consumers can find API docs and release notes directly from RubyGems.

Apply this diff to extend metadata:

   s.metadata['rubygems_mfa_required'] = 'true'
   s.metadata['source_code_uri'] = 'https://github.com/meilisearch/meilisearch-ruby'
   s.metadata['bug_tracker_uri'] = 'https://github.com/meilisearch/meilisearch-ruby/issues'
+  s.metadata['documentation_uri'] = 'https://www.rubydoc.info/gems/meilisearch'
+  s.metadata['changelog_uri'] = 'https://github.com/meilisearch/meilisearch-ruby/blob/main/CHANGELOG.md'
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cb0fab8 and 85a9f07.

📒 Files selected for processing (3)
  • lib/meilisearch/index.rb (1 hunks)
  • meilisearch.gemspec (1 hunks)
  • spec/meilisearch/index/documents_spec.rb (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • spec/meilisearch/index/documents_spec.rb
  • lib/meilisearch/index.rb
🔇 Additional comments (2)
meilisearch.gemspec (2)

19-19: No-op whitespace change.

Blank line insertion is fine; no functional impact.


21-22: LGTM: Adds standard RubyGems metadata URIs.

source_code_uri and bug_tracker_uri are recognized by RubyGems and correctly point to the repo and issues.

@curquiza curquiza requested a review from brunoocasali August 26, 2025 11:26
s.add_dependency 'httparty', '~> 0.22'

s.metadata['rubygems_mfa_required'] = 'true'
s.metadata['source_code_uri'] = 'https://github.com/meilisearch/meilisearch-ruby'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice suggestion!

Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your contrib! <3

@brunoocasali brunoocasali merged commit ea2dccf into meilisearch:main Sep 8, 2025
8 checks passed
@brunoocasali brunoocasali added the enhancement New feature or request label Sep 8, 2025
@Nymuxyzo Nymuxyzo deleted the feat/documents_by_ids branch September 9, 2025 08:59
@coderabbitai coderabbitai bot mentioned this pull request Sep 9, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v1.14] Get documents by ID

2 participants