meilisearch / meilisearch/meilisearch-ruby
Ruby hashes/arrays to Meilisearch filter expressions
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 224
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Description
Description
It would be nice to provide a class like Meilisearch::FilterBuilder that converts Ruby hashes/arrays to Meilisearch filter expressions.
I already did that in one of my projects and it provides a huge added value. I just get the params from the request, build the hash, then pass it to the builder.
The question is, will you be open to upstream the implementation of my builder into the gem? Or should I extract the class to my own gem ?,? (Any naming suggestions in this case 😅)
Basic example
Example 1
Ruby object:
or: [
{ genres: 'horror' },
{ and: [
{ genres: 'comedy' },
{ release_date: { gt: 795_484_800 } }
] }
]
Meilisearch filter expressions:
genres = horror OR (genres = comedy AND release_date > 795484800)
Example 2
Ruby object:
{ genres: 'horror', director: 'Jordan Peele' }
Meilisearch filter expressions:
genres = horror AND director = 'Jordan Peele'
Example 3
Ruby object:
{ not: { genres: { in: %w[horror comedy] } } }
Meilisearch filter expressions:
NOT (genres IN [horror, comedy])
Other
I have the implementation and the specs for it, but I'm not sure about publishing a PR to this gem, or extract it to my own gem.
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
Start by reviewing the issue's three Ruby-to-Meilisearch examples and the author's existing implementation and specs. Determine the intended FilterBuilder API, supported operators, nesting, arrays, and escaping before proposing a contribution. Done means the scope is agreed and the behavior is covered by specs for the documented examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100