feat: add /fields route#756
Conversation
📝 WalkthroughWalkthroughAdds a new public Changes
Sequence DiagramsequenceDiagram
participant User as User
participant FQ as FieldsQuery
participant IDX as Index
participant HTTP as HttpClient
participant MS as MeiliSearch
User->>FQ: new(index) / with_* builders
User->>FQ: execute()
FQ->>IDX: get_fields_with(self)
IDX->>HTTP: send request GET /indexes/{uid}/fields (params/body)
HTTP->>MS: HTTP request
MS->>HTTP: JSON response (fields metadata)
HTTP->>IDX: parsed FieldsResult
IDX->>FQ: return FieldsResult
FQ->>User: Result<FieldsResult>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/fields.rs`:
- Around line 49-71: The FieldsQuery struct currently serializes filter: None as
"filter": null; update the filter field in struct FieldsQuery<'a, Http:
HttpClient> to add #[serde(skip_serializing_if = "Option::is_none")] so it is
omitted when None (matching offset and limit), and update its doc comment to
read "All fields returned must match **all** of the filter criteria" and format
FieldsQueryFilter with backticks (`FieldsQueryFilter`) in the docstring.
🧹 Nitpick comments (1)
src/fields.rs (1)
244-249: Typo in parameter name (distint).
Consider renaming todistinctto keep rustdoc output clean.✏️ Suggested tweak
- pub fn with_distinct(mut self, distint: bool) -> Self { - self.distinct = Some(distint); + pub fn with_distinct(mut self, distinct: bool) -> Self { + self.distinct = Some(distinct);
|
Hey @curquiza, let me know if you can review this PR and if not let me know who to ping |
Pull Request
Related issue
Closes #755
What does this PR do?
/fieldsroutefieldsget_fieldsandget_fields_withtoIndexFieldsQuerystruct to represent a/fieldsqueryFieldsQueryFilterstruct to represent thefilterkey in the body of a/fieldsrequestFieldInfostruct to represent the response of a/fieldsrequestI was not sure if a top-level module should be dedicated to this or should I put it inside the
indexesmodule. I went with a top level module and copied the pattern used inIndexQuery.PR checklist
Please check if your PR fulfills the following requirements:
I did not use AI
Summary by CodeRabbit
New Features
Tests
Documentation