meilisearch / meilisearch-dart

The Meilisearch API client written for Dart
https://meilisearch.com
MIT License
77 stars 26 forks source link

Add Result container #350

Closed ahmednfwela closed 11 months ago

ahmednfwela commented 1 year ago

Pull Request

Related issue

Fixes #335 Fixes #337 Fixes #338 Starts work on #276

What does this PR do?

In this PR the main feature is adding MeiliDocumentContainer<T>, which wraps around documents returned by meilisearch and adds typed, useful information to them.

I have also added a dependency on json_serializable to generate serialization information for models (toJson + fromJson), but I will be rolling all models gradually.

Here is the complete list of changes:

  1. chore: updated CONTRIBUTING.md to include instructions on generating json_serializable files.
  2. feat: added getExperimentalFeatures and updateExperimentalFeatures to MeiliSearchClient
  3. feat: added to SearchQuery and IndexSearchQuery 3.1. List? vector 3.2. bool? showRankingScore 3.3. bool? showRankingScoreDetails
  4. feat: added MeiliDocumentContainer<T>
  5. feat: added Map<String, dynamic> src to Searcheable, which exposes the raw json object returned from the server. REASON: just in case we don't keep up with new meilisearch releases, the user has a way to access new features.
  6. [BREAKING] fix: Searcheable<T> had a wrong matchesPosition property, which I have moved into MeiliDocumentContainer<T>
  7. [BREAKING] fix: Marked all the fields in Searcheable<T> constructor as required REASON: just in case we forget to add them in PaginatedSearchResult<T> or SearchResult<T>

PR checklist

Please check if your PR fulfills the following requirements:

Thank you so much for contributing to Meilisearch!

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 70.06% and project coverage change: -0.81% :warning:

Comparison is base (758a4b8) 82.84% compared to head (6ebd988) 82.03%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #350 +/- ## ========================================== - Coverage 82.84% 82.03% -0.81% ========================================== Files 48 57 +9 Lines 1218 1353 +135 ========================================== + Hits 1009 1110 +101 - Misses 209 243 +34 ``` | [Files Changed](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch) | Coverage Δ | | |---|---|---| | [lib/src/query\_parameters/index\_search\_query.dart](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch#diff-bGliL3NyYy9xdWVyeV9wYXJhbWV0ZXJzL2luZGV4X3NlYXJjaF9xdWVyeS5kYXJ0) | `19.35% <0.00%> (-2.08%)` | :arrow_down: | | [lib/src/results/paginated\_search\_result.dart](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch#diff-bGliL3NyYy9yZXN1bHRzL3BhZ2luYXRlZF9zZWFyY2hfcmVzdWx0LmRhcnQ=) | `46.42% <25.00%> (-5.43%)` | :arrow_down: | | [lib/src/results/ranking\_rules/base.dart](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch#diff-bGliL3NyYy9yZXN1bHRzL3JhbmtpbmdfcnVsZXMvYmFzZS5kYXJ0) | `33.33% <33.33%> (ø)` | | | [lib/src/results/searchable.dart](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch#diff-bGliL3NyYy9yZXN1bHRzL3NlYXJjaGFibGUuZGFydA==) | `73.33% <33.33%> (-26.67%)` | :arrow_down: | | [lib/src/results/searchable\_helpers.dart](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch#diff-bGliL3NyYy9yZXN1bHRzL3NlYXJjaGFibGVfaGVscGVycy5kYXJ0) | `75.00% <33.33%> (ø)` | | | [lib/src/query\_parameters/search\_query.dart](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch#diff-bGliL3NyYy9xdWVyeV9wYXJhbWV0ZXJzL3NlYXJjaF9xdWVyeS5kYXJ0) | `50.00% <50.00%> (ø)` | | | [lib/src/results/document\_container.dart](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch#diff-bGliL3NyYy9yZXN1bHRzL2RvY3VtZW50X2NvbnRhaW5lci5kYXJ0) | `67.30% <67.30%> (ø)` | | | [lib/src/results/experimental\_features.dart](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch#diff-bGliL3NyYy9yZXN1bHRzL2V4cGVyaW1lbnRhbF9mZWF0dXJlcy5kYXJ0) | `73.33% <73.33%> (ø)` | | | [lib/src/results/experimental\_features.g.dart](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch#diff-bGliL3NyYy9yZXN1bHRzL2V4cGVyaW1lbnRhbF9mZWF0dXJlcy5nLmRhcnQ=) | `100.00% <100.00%> (ø)` | | | [lib/src/results/ranking\_rules/attribute.dart](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch#diff-bGliL3NyYy9yZXN1bHRzL3JhbmtpbmdfcnVsZXMvYXR0cmlidXRlLmRhcnQ=) | `100.00% <100.00%> (ø)` | | | ... and [5 more](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch) | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/meilisearch/meilisearch-dart/pull/350/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meilisearch)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

meili-bors[bot] commented 11 months ago

Build succeeded: