diff --git a/README.md b/README.md index 85e4a39c..d3858d34 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,8 @@ await index.search('wonder', filter: ['id > 1 AND genres = Action']); This package guarantees compatibility with [version v1.x of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/latest), but some features may not be present. Please check the [issues](https://github.com/meilisearch/meilisearch-dart/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+label%3Aenhancement) for more info. +⚠️ This package is not compatible with the [`vectoreStore` experimental feature](https://www.meilisearch.com/docs/learn/experimental/vector_search) of Meilisearch v1.6.0 and later. More information on this [issue](https://github.com/meilisearch/meilisearch-dart/issues/369). + ## 💡 Learn more The following sections in our main documentation website may interest you: diff --git a/pubspec.yaml b/pubspec.yaml index 1877f916..5dbe7b7b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: dev_dependencies: test: ^1.0.0 - dart_jsonwebtoken: ^2.3.2 + dart_jsonwebtoken: ^2.12.2 lints: ">=2.1.0 <4.0.0" json_serializable: ^6.7.1 build_runner: ^2.4.6 diff --git a/test/search_test.dart b/test/search_test.dart index 45a17688..939c897b 100644 --- a/test/search_test.dart +++ b/test/search_test.dart @@ -1,5 +1,4 @@ import 'package:meilisearch/meilisearch.dart'; -import 'package:meilisearch/src/results/experimental_features.dart'; import 'package:test/test.dart'; import 'utils/books.dart'; @@ -449,161 +448,162 @@ void main() { }); }); - group('Experimental', () { - setUpClient(); - late String uid; - late MeiliSearchIndex index; - late ExperimentalFeatures features; - setUp(() async { - features = await client.http.updateExperimentalFeatures( - UpdateExperimentalFeatures( - scoreDetails: true, - vectorStore: true, - ), - ); - expect(features.scoreDetails, true); - expect(features.vectorStore, true); - - uid = randomUid(); - index = await createIndexWithData(uid: uid, data: vectorBooks); - }); - - test('vector search', () async { - final vector = [0, 1, 2]; - final res = await index - .search( - null, - SearchQuery( - vector: vector, - ), - ) - .asSearchResult() - .mapToContainer(); - - expect(res.vector, vector); - expect( - res.hits, - everyElement( - isA>>() - .having( - (p0) => p0.vectors, - 'vectors', - isNotNull, - ) - .having( - (p0) => p0.semanticScore, - 'semanticScore', - isNotNull, - ), - ), - ); - }); - - test('normal search', () async { - final res = await index - .search( - 'The', - SearchQuery( - showRankingScore: true, - showRankingScoreDetails: true, - attributesToHighlight: ['*'], - showMatchesPosition: true, - ), - ) - .asSearchResult() - .mapToContainer(); - - final attributeMatcher = isA() - .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) - .having((p0) => p0.score, 'score', isNotNull) - .having((p0) => p0.order, 'order', isNotNull) - .having((p0) => p0.queryWordDistanceScore, 'queryWordDistanceScore', - isNotNull) - .having((p0) => p0.attributeRankingOrderScore, - 'attributeRankingOrderScore', isNotNull); - - final wordsMatcher = isA() - .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) - .having((p0) => p0.score, 'score', isNotNull) - .having((p0) => p0.order, 'order', isNotNull) - .having((p0) => p0.matchingWords, 'matchingWords', isNotNull) - .having((p0) => p0.maxMatchingWords, 'maxMatchingWords', isNotNull); - - final exactnessMatcher = isA() - .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) - .having((p0) => p0.score, 'score', isNotNull) - .having((p0) => p0.order, 'order', isNotNull) - .having( - (p0) => p0.matchType, - 'matchType', - allOf(isNotNull, isNotEmpty), - ); - - final typoMatcher = isA() - .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) - .having((p0) => p0.score, 'score', isNotNull) - .having((p0) => p0.order, 'order', isNotNull) - .having((p0) => p0.typoCount, 'typoCount', isNotNull) - .having((p0) => p0.maxTypoCount, 'maxTypoCount', isNotNull); - - final proximityMatcher = isA() - .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) - .having((p0) => p0.score, 'score', isNotNull) - .having((p0) => p0.order, 'order', isNotNull); - - final rankingScoreDetailsMatcher = isA() - .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) - .having((p0) => p0.attribute, 'attribute', attributeMatcher) - .having((p0) => p0.words, 'words', wordsMatcher) - .having((p0) => p0.exactness, 'exactness', exactnessMatcher) - .having((p0) => p0.typo, 'typo', typoMatcher) - .having((p0) => p0.proximity, 'proximity', proximityMatcher) - .having( - (p0) => p0.customRules, 'customRules', allOf(isNotNull, isEmpty)); - - expect(res.hits.length, 2); - - expect( - res.hits, - everyElement( - isA>>() - .having( - (p0) => p0.formatted, - 'formatted', - allOf(isNotNull, isNotEmpty, contains('id')), - ) - .having( - (p0) => p0.matchesPosition, - 'matchesPosition', - allOf(isNotNull, isNotEmpty, containsPair('title', isNotEmpty)), - ) - .having( - (p0) => p0.parsed, - 'parsed', - isNotEmpty, - ) - .having( - (p0) => p0.src, - 'src', - isNotEmpty, - ) - .having( - (p0) => p0.rankingScore, - 'rankingScore', - isNotNull, - ) - .having( - (p0) => p0.rankingScoreDetails, - 'rankingScoreDetails', - rankingScoreDetailsMatcher, - ) - .having( - (p0) => p0.vectors, 'vectors', allOf(isNotNull, isNotEmpty)) - .having((p0) => p0.semanticScore, 'semanticScore', isNull), - ), - ); - }); - }); + // Commented because of https://github.com/meilisearch/meilisearch-dart/issues/369 + // group('Experimental', () { + // setUpClient(); + // late String uid; + // late MeiliSearchIndex index; + // late ExperimentalFeatures features; + // setUp(() async { + // features = await client.http.updateExperimentalFeatures( + // UpdateExperimentalFeatures( + // scoreDetails: true, + // vectorStore: true, + // ), + // ); + // expect(features.scoreDetails, true); + // expect(features.vectorStore, true); + + // uid = randomUid(); + // index = await createIndexWithData(uid: uid, data: vectorBooks); + // }); + + // test('vector search', () async { + // final vector = [0, 1, 2]; + // final res = await index + // .search( + // null, + // SearchQuery( + // vector: vector, + // ), + // ) + // .asSearchResult() + // .mapToContainer(); + + // expect(res.vector, vector); + // expect( + // res.hits, + // everyElement( + // isA>>() + // .having( + // (p0) => p0.vectors, + // 'vectors', + // isNotNull, + // ) + // .having( + // (p0) => p0.semanticScore, + // 'semanticScore', + // isNotNull, + // ), + // ), + // ); + // }); + + // test('normal search', () async { + // final res = await index + // .search( + // 'The', + // SearchQuery( + // showRankingScore: true, + // showRankingScoreDetails: true, + // attributesToHighlight: ['*'], + // showMatchesPosition: true, + // ), + // ) + // .asSearchResult() + // .mapToContainer(); + + // final attributeMatcher = isA() + // .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) + // .having((p0) => p0.score, 'score', isNotNull) + // .having((p0) => p0.order, 'order', isNotNull) + // .having((p0) => p0.queryWordDistanceScore, 'queryWordDistanceScore', + // isNotNull) + // .having((p0) => p0.attributeRankingOrderScore, + // 'attributeRankingOrderScore', isNotNull); + + // final wordsMatcher = isA() + // .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) + // .having((p0) => p0.score, 'score', isNotNull) + // .having((p0) => p0.order, 'order', isNotNull) + // .having((p0) => p0.matchingWords, 'matchingWords', isNotNull) + // .having((p0) => p0.maxMatchingWords, 'maxMatchingWords', isNotNull); + + // final exactnessMatcher = isA() + // .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) + // .having((p0) => p0.score, 'score', isNotNull) + // .having((p0) => p0.order, 'order', isNotNull) + // .having( + // (p0) => p0.matchType, + // 'matchType', + // allOf(isNotNull, isNotEmpty), + // ); + + // final typoMatcher = isA() + // .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) + // .having((p0) => p0.score, 'score', isNotNull) + // .having((p0) => p0.order, 'order', isNotNull) + // .having((p0) => p0.typoCount, 'typoCount', isNotNull) + // .having((p0) => p0.maxTypoCount, 'maxTypoCount', isNotNull); + + // final proximityMatcher = isA() + // .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) + // .having((p0) => p0.score, 'score', isNotNull) + // .having((p0) => p0.order, 'order', isNotNull); + + // final rankingScoreDetailsMatcher = isA() + // .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty)) + // .having((p0) => p0.attribute, 'attribute', attributeMatcher) + // .having((p0) => p0.words, 'words', wordsMatcher) + // .having((p0) => p0.exactness, 'exactness', exactnessMatcher) + // .having((p0) => p0.typo, 'typo', typoMatcher) + // .having((p0) => p0.proximity, 'proximity', proximityMatcher) + // .having( + // (p0) => p0.customRules, 'customRules', allOf(isNotNull, isEmpty)); + + // expect(res.hits.length, 2); + + // expect( + // res.hits, + // everyElement( + // isA>>() + // .having( + // (p0) => p0.formatted, + // 'formatted', + // allOf(isNotNull, isNotEmpty, contains('id')), + // ) + // .having( + // (p0) => p0.matchesPosition, + // 'matchesPosition', + // allOf(isNotNull, isNotEmpty, containsPair('title', isNotEmpty)), + // ) + // .having( + // (p0) => p0.parsed, + // 'parsed', + // isNotEmpty, + // ) + // .having( + // (p0) => p0.src, + // 'src', + // isNotEmpty, + // ) + // .having( + // (p0) => p0.rankingScore, + // 'rankingScore', + // isNotNull, + // ) + // .having( + // (p0) => p0.rankingScoreDetails, + // 'rankingScoreDetails', + // rankingScoreDetailsMatcher, + // ) + // .having( + // (p0) => p0.vectors, 'vectors', allOf(isNotNull, isNotEmpty)) + // .having((p0) => p0.semanticScore, 'semanticScore', isNull), + // ), + // ); + // }); + // }); test('search code samples', () async { // #docregion search_get_1