-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes for v1.2.0 #318
Changes for v1.2.0 #318
Conversation
There was a problem hiding this 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 taking care of this release @ahmednfwela 🎉
Besides the comments I've made here, I would like to highlight a particular desire that is creating smaller PRs, especially in the pre-release weeks.
We usually have to deal with a huge amount of context-switch moments, and it is incredibly painful to do a proper review when the PR goes all over the place.
These kinds of improvements will always be welcomed, but it would surely make my life much easier if you could break it into smaller PRs next time. 😅
} | ||
|
||
@MeiliServerVersion('1.2.0') | ||
class MeiliIsEmptyOperatorExpression extends MeiliOperatorExpressionBase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to call Meili
all the time? I don't know if it is worthy repeating that since its inside of the meilisearch dart SDK + it is not exported (as far as I remember).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's exported in the _exports file in the same folder
funny enough, I actually started this PR to only add the delete/fetch methods (as can be seen from the branch name), but I forgot to switch to a different branch midway, and everything got jumbled up together, so definitely sorry about that 😅 |
lib/src/index.dart
Outdated
Future<Task> deleteDocuments([DeleteDocumentsQuery? query]) async { | ||
Object? deleteBatchData; | ||
Object? deleteData; | ||
if (query != null) { | ||
if (query.ids != null) { | ||
// if ids are available, fallback to the delete-batch route | ||
deleteBatchData = query.ids; | ||
} else { | ||
// if ids are NOT available, use the new delete route | ||
deleteData = query.toSparseMap(); | ||
} | ||
} | ||
|
||
Future<Response<Map<String, Object?>>> future; | ||
if (deleteData != null) { | ||
future = http.postMethod( | ||
'/indexes/$uid/documents/delete', | ||
data: deleteData, | ||
); | ||
} else { | ||
future = http.postMethod( | ||
'/indexes/$uid/documents/delete-batch', | ||
data: ids, | ||
), | ||
); | ||
data: deleteBatchData, | ||
); | ||
} | ||
|
||
return await _getTask(future); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think?
Future<Task> deleteDocuments([DeleteDocumentsQuery? query]) async {
String route = 'delete';
Object? data;
if (query != null) {
if (query.ids != null) {
// if ids are available, fallback to the delete-batch route
data = query.ids;
route = '$route-batch';
} else {
// if ids are NOT available, use the new delete route
data = query.toSparseMap();
}
}
return await _getTask(
http.postMethod('/indexes/$uid/documents/$route', data: data)
);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the logic, and also added client-side assertions to prevent bad inputs, since the server will throw on them anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relevant commit: 47eed42
this.filter, | ||
this.filterExpression, | ||
}) : assert( | ||
(ids != null && ids.isNotEmpty) ^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, that's cool!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!!
Thank you, @ahmednfwela, for all your work in this repository, it is incredibly amazing to see how much this repository improved in the past months!
This message is sent automatically Thank you very much for submitting your PR! Did you know that throughout the month of June we’re holding a rafle? |
323: Update version for the next release (v0.14.0) r=brunoocasali a=meili-bot This version introduces features released on Meilisearch v1.2.0 🎉 Check out the changelog of [Meilisearch v1.2.0](https://github.com/meilisearch/meilisearch/releases/tag/v1.2.0) for more information on the changes.⚠️ If you want to adopt new features of this release, **update the Meilisearch server** to the according version. Check the complete CHANGELOG here: https://github.com/meilisearch/meilisearch-dart/blob/main/CHANGELOG.md ### 💥 Breaking changes - The method `deleteDocuments()` now supports a different behavior. This method now takes a `DeleteDocumentsQuery`, which could contain the filter or the `ids` (aka old behavior). #318 `@ahmednfwela`⚠️ You must configure the attributes you want to filter using the `MeiliSearchIndex.filterableAttributes()`.⚠️ Remember to **update your Meilisearch server to v1.2.0 or newer before** adopting it. Still, even being supported, the ability to receive only a list of ids is *deprecated*, and it will be removed soon. ```diff // from: - Future<Task> deleteDocuments(List<Object> ids) + Future<Task> deleteDocuments(DeleteDocumentsQuery query) // to: - index.deleteDocuments([456, 4]) + index.deleteDocuments(DeleteDocumentsQuery(ids: [456, 4])) ``` - Add the ability to set `filter` in the `DocumentsQuery`. When a query with a `filter` is sent to `getDocuments(params: DocumentsQuery)` it will filter the documents like the `search` method. See [the docs on how to use filters](https://www.meilisearch.com/docs/learn/advanced/filtering#filter-basics). #318 `@ahmednfwela`⚠️ You must configure the attributes you want to filter using the `MeiliSearchIndex.filterableAttributes()`.⚠️ Remember to **update your Meilisearch server to v1.2.0 or newer before** adopting it. - `MeiliSearchIndex.search` now takes a `String query` and a `SearchQuery` object as the only inputs. #310 `@ahmednfwela` - Replace any occurrence of search `index.search('xyz', ....)` with `index.search('xyz', SearchQuery(....))` ```diff - await client.index('books').search('query', sort: [], filter: ...); + await client.index('books').search('query', SearchQuery(sort: [], filter: ...)); ``` - `Meili.geoBoundingBox` and `Meili.geoRadius` now take record values to represent the `lat`/`lng` points: #310 `@ahmednfwela` ```diff // Confusing, unclear - Meili.geoBoundingBox(3,5.3,10,20) // Not Confusing :) + Meili.geoBoundingBox((lat: 3, lng: 5.3), (lat: 10, lng: 20)) ``` ```diff // Confusing, unclear - Meili.geoRadius(3, 5.3, 100) // Not Confusing :) + Meili.geoRadius((lat: 3, lng: 5.3), 100) ``` - Change `MultiSearchQuery.queries` to be a `List<IndexSearchQuery>` instead of a `List<SearchQuery>`: #310 `@ahmednfwela` ```diff final result = await client.multiSearch(MultiSearchQuery(queries: [ - SearchQuery( + IndexSearchQuery( query: "", indexUid: index1.uid, ), - SearchQuery( + IndexSearchQuery( query: "", indexUid: index2.uid, ), ]; ``` ### Enhancements: - Introduce a new annotation `RequiredMeiliServerVersion` which documents the version these members were introduced. #310 `@ahmednfwela` - Introduce filter expressions for `IS NULL`, `IS NOT NULL`, `IS EMPTY`, `IS NOT EMPTY`. #310 `@ahmednfwela` - Added `filter`, `filterExpression` parameter to `DocumentsQuery`. #310 `@ahmednfwela` - Some internal `Queryable` refactoring to unify its behavior and avoid duplicating the code. #310 `@ahmednfwela` - Added a workaround for meilisearch/meilisearch#3740 by `jsonEncoding` attribute names when using `filterExpression`s #310 `@ahmednfwela` - A new type is introduced `IndexSearchQuery` which extends `SearchQuery`. #310 `@ahmednfwela` - Added `copyWith` to `SearchQuery` and `IndexSearchQuery` #310 `@ahmednfwela` Thanks again to `@brunoocasali,` `@ahmednfwela!` 🎉 Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com> Co-authored-by: Bruno Casali <brunoocasali@gmail.com>
Pull Request
Related issue
Implements meilisearch/integration-guides#261
What does this PR do?
RequiredMeiliServerVersion
which does nothing for now, but we can use it to document at which version members are introduced.IS NULL
,IS NOT NULL
,IS EMPTY
,IS NOT EMPTY
Queryable
refactoring to unify its behavior and avoid duplicating the code.DocumentsQuery
deleteDocuments
SignatureMigration guide
PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!