meilisearch / meilisearch/meilisearch-ruby
Refactor `Meilisearch::Index` class
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 224
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Description
Description
The Meilisearch::Index class is over 1400 lines long and handles too many responsibilities: documents, search, facet search, settings, stats, and compaction. This makes it difficult to navigate, maintain, and review changes.
The class can be split into focused modules, each responsible for a specific area of the API, without breaking the public interface.
Basic example
All public methods continue to work without changes:
index = client.index('movies')
index.add_documents([{ id: 1, title: 'Cloud Atlas' }])
index.search('cloud')
index.settings
Internally, the Meilisearch::Index class would include separate modules:
module Meilisearch
class Index < HTTPRequest
require 'meilisearch/index/documents'
require 'meilisearch/index/search'
require 'meilisearch/index/settings'
# ...
end
end
Each self-contained module would live under the Meilisearch::Index class namespace (e.g. Meilisearch::Index::Documents, Meilisearch::Index::Search):
# lib/meilisearch/index/search.rb
module Meilisearch
class Index
module Search
end
include Search
end
end
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the current Meilisearch::Index implementation and compare its responsibilities with the proposed modules under lib/meilisearch/index/, including search.rb. Group the existing methods by the named areas while preserving the public interface, then run the existing test suite; done means the documented add_documents, search, and settings calls continue to work unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100