Skip to content

Commit c9dec3d

Browse files
meili-bors[bot]meili-botcurquizaahmednfwela
authored
Merge #375
375: Changes related to the next Meilisearch release (v1.7.0) r=curquiza a=meili-bot Related to this issue: meilisearch/integration-guides#296 This PR: - gathers the changes related to the next Meilisearch release (v1.7.0) so that this package is ready when the official release is out. - should pass the tests against the [latest pre-release of Meilisearch](https://github.com/meilisearch/meilisearch/releases). - might eventually contain test failures until the Meilisearch v1.7.0 is out. ⚠️ This PR should NOT be merged until the next release of Meilisearch (v1.7.0) is out. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/main/resources/pre-release-week.md) purpose._ Co-authored-by: meili-bot <[email protected]> Co-authored-by: curquiza <[email protected]> Co-authored-by: Ahmed Fwela <[email protected]> Co-authored-by: Ahmed Fwela <[email protected]> Co-authored-by: Clémentine U. - curqui <[email protected]>
2 parents 4c7a4ac + 816b98e commit c9dec3d

File tree

3 files changed

+92
-115
lines changed

3 files changed

+92
-115
lines changed

lib/src/results/experimental_features.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ part 'experimental_features.g.dart';
1313
class ExperimentalFeatures {
1414
@JsonKey(name: 'vectorStore')
1515
final bool vectorStore;
16-
@JsonKey(name: 'scoreDetails')
17-
final bool scoreDetails;
1816

1917
const ExperimentalFeatures({
2018
required this.vectorStore,
21-
required this.scoreDetails,
2219
});
2320

2421
factory ExperimentalFeatures.fromJson(Map<String, dynamic> src) {
@@ -34,12 +31,9 @@ class ExperimentalFeatures {
3431
class UpdateExperimentalFeatures {
3532
@JsonKey(name: 'vectorStore')
3633
final bool? vectorStore;
37-
@JsonKey(name: 'scoreDetails')
38-
final bool? scoreDetails;
3934

4035
const UpdateExperimentalFeatures({
4136
this.vectorStore,
42-
this.scoreDetails,
4337
});
4438

4539
Map<String, dynamic> toJson() => _$UpdateExperimentalFeaturesToJson(this);

lib/src/results/experimental_features.g.dart

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/search_test.dart

Lines changed: 92 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,98 @@ void main() {
5454
expect(result.hits, hasLength(1));
5555
});
5656

57+
test('Show ranking score details', () async {
58+
final res = await index
59+
.search(
60+
'The',
61+
SearchQuery(
62+
showRankingScore: true,
63+
showRankingScoreDetails: true,
64+
attributesToHighlight: ['*'],
65+
showMatchesPosition: true,
66+
),
67+
)
68+
.asSearchResult()
69+
.mapToContainer();
70+
71+
final attributeMatcher = isA<MeiliRankingScoreDetailsAttributeRule>()
72+
.having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
73+
.having((p0) => p0.score, 'score', isNotNull)
74+
.having((p0) => p0.order, 'order', isNotNull)
75+
.having((p0) => p0.queryWordDistanceScore, 'queryWordDistanceScore',
76+
isNotNull)
77+
.having((p0) => p0.attributeRankingOrderScore,
78+
'attributeRankingOrderScore', isNotNull);
79+
80+
final wordsMatcher = isA<MeiliRankingScoreDetailsWordsRule>()
81+
.having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
82+
.having((p0) => p0.score, 'score', isNotNull)
83+
.having((p0) => p0.order, 'order', isNotNull)
84+
.having((p0) => p0.matchingWords, 'matchingWords', isNotNull)
85+
.having((p0) => p0.maxMatchingWords, 'maxMatchingWords', isNotNull);
86+
87+
final exactnessMatcher = isA<MeiliRankingScoreDetailsExactnessRule>()
88+
.having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
89+
.having((p0) => p0.score, 'score', isNotNull)
90+
.having((p0) => p0.order, 'order', isNotNull)
91+
.having(
92+
(p0) => p0.matchType,
93+
'matchType',
94+
allOf(isNotNull, isNotEmpty),
95+
);
96+
97+
final typoMatcher = isA<MeiliRankingScoreDetailsTypoRule>()
98+
.having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
99+
.having((p0) => p0.score, 'score', isNotNull)
100+
.having((p0) => p0.order, 'order', isNotNull)
101+
.having((p0) => p0.typoCount, 'typoCount', isNotNull)
102+
.having((p0) => p0.maxTypoCount, 'maxTypoCount', isNotNull);
103+
104+
final proximityMatcher = isA<MeiliRankingScoreDetailsProximityRule>()
105+
.having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
106+
.having((p0) => p0.score, 'score', isNotNull)
107+
.having((p0) => p0.order, 'order', isNotNull);
108+
109+
final rankingScoreDetailsMatcher = isA<MeiliRankingScoreDetails>()
110+
.having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
111+
.having((p0) => p0.attribute, 'attribute', attributeMatcher)
112+
.having((p0) => p0.words, 'words', wordsMatcher)
113+
.having((p0) => p0.exactness, 'exactness', exactnessMatcher)
114+
.having((p0) => p0.typo, 'typo', typoMatcher)
115+
.having((p0) => p0.proximity, 'proximity', proximityMatcher)
116+
.having((p0) => p0.customRules, 'customRules',
117+
allOf(isNotNull, isEmpty));
118+
119+
expect(res.hits.length, 4);
120+
121+
expect(
122+
res.hits,
123+
everyElement(
124+
isA<MeiliDocumentContainer<Map<String, dynamic>>>()
125+
.having(
126+
(p0) => p0.parsed,
127+
'parsed',
128+
isNotEmpty,
129+
)
130+
.having(
131+
(p0) => p0.src,
132+
'src',
133+
isNotEmpty,
134+
)
135+
.having(
136+
(p0) => p0.rankingScore,
137+
'rankingScore',
138+
isNotNull,
139+
)
140+
.having(
141+
(p0) => p0.rankingScoreDetails,
142+
'rankingScoreDetails',
143+
rankingScoreDetailsMatcher,
144+
),
145+
),
146+
);
147+
});
148+
57149
group('with', () {
58150
test('offset parameter', () async {
59151
final result =
@@ -457,11 +549,9 @@ void main() {
457549
// setUp(() async {
458550
// features = await client.http.updateExperimentalFeatures(
459551
// UpdateExperimentalFeatures(
460-
// scoreDetails: true,
461552
// vectorStore: true,
462553
// ),
463554
// );
464-
// expect(features.scoreDetails, true);
465555
// expect(features.vectorStore, true);
466556

467557
// uid = randomUid();
@@ -498,111 +588,6 @@ void main() {
498588
// ),
499589
// );
500590
// });
501-
502-
// test('normal search', () async {
503-
// final res = await index
504-
// .search(
505-
// 'The',
506-
// SearchQuery(
507-
// showRankingScore: true,
508-
// showRankingScoreDetails: true,
509-
// attributesToHighlight: ['*'],
510-
// showMatchesPosition: true,
511-
// ),
512-
// )
513-
// .asSearchResult()
514-
// .mapToContainer();
515-
516-
// final attributeMatcher = isA<MeiliRankingScoreDetailsAttributeRule>()
517-
// .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
518-
// .having((p0) => p0.score, 'score', isNotNull)
519-
// .having((p0) => p0.order, 'order', isNotNull)
520-
// .having((p0) => p0.queryWordDistanceScore, 'queryWordDistanceScore',
521-
// isNotNull)
522-
// .having((p0) => p0.attributeRankingOrderScore,
523-
// 'attributeRankingOrderScore', isNotNull);
524-
525-
// final wordsMatcher = isA<MeiliRankingScoreDetailsWordsRule>()
526-
// .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
527-
// .having((p0) => p0.score, 'score', isNotNull)
528-
// .having((p0) => p0.order, 'order', isNotNull)
529-
// .having((p0) => p0.matchingWords, 'matchingWords', isNotNull)
530-
// .having((p0) => p0.maxMatchingWords, 'maxMatchingWords', isNotNull);
531-
532-
// final exactnessMatcher = isA<MeiliRankingScoreDetailsExactnessRule>()
533-
// .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
534-
// .having((p0) => p0.score, 'score', isNotNull)
535-
// .having((p0) => p0.order, 'order', isNotNull)
536-
// .having(
537-
// (p0) => p0.matchType,
538-
// 'matchType',
539-
// allOf(isNotNull, isNotEmpty),
540-
// );
541-
542-
// final typoMatcher = isA<MeiliRankingScoreDetailsTypoRule>()
543-
// .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
544-
// .having((p0) => p0.score, 'score', isNotNull)
545-
// .having((p0) => p0.order, 'order', isNotNull)
546-
// .having((p0) => p0.typoCount, 'typoCount', isNotNull)
547-
// .having((p0) => p0.maxTypoCount, 'maxTypoCount', isNotNull);
548-
549-
// final proximityMatcher = isA<MeiliRankingScoreDetailsProximityRule>()
550-
// .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
551-
// .having((p0) => p0.score, 'score', isNotNull)
552-
// .having((p0) => p0.order, 'order', isNotNull);
553-
554-
// final rankingScoreDetailsMatcher = isA<MeiliRankingScoreDetails>()
555-
// .having((p0) => p0.src, 'src', allOf(isNotNull, isNotEmpty))
556-
// .having((p0) => p0.attribute, 'attribute', attributeMatcher)
557-
// .having((p0) => p0.words, 'words', wordsMatcher)
558-
// .having((p0) => p0.exactness, 'exactness', exactnessMatcher)
559-
// .having((p0) => p0.typo, 'typo', typoMatcher)
560-
// .having((p0) => p0.proximity, 'proximity', proximityMatcher)
561-
// .having(
562-
// (p0) => p0.customRules, 'customRules', allOf(isNotNull, isEmpty));
563-
564-
// expect(res.hits.length, 2);
565-
566-
// expect(
567-
// res.hits,
568-
// everyElement(
569-
// isA<MeiliDocumentContainer<Map<String, dynamic>>>()
570-
// .having(
571-
// (p0) => p0.formatted,
572-
// 'formatted',
573-
// allOf(isNotNull, isNotEmpty, contains('id')),
574-
// )
575-
// .having(
576-
// (p0) => p0.matchesPosition,
577-
// 'matchesPosition',
578-
// allOf(isNotNull, isNotEmpty, containsPair('title', isNotEmpty)),
579-
// )
580-
// .having(
581-
// (p0) => p0.parsed,
582-
// 'parsed',
583-
// isNotEmpty,
584-
// )
585-
// .having(
586-
// (p0) => p0.src,
587-
// 'src',
588-
// isNotEmpty,
589-
// )
590-
// .having(
591-
// (p0) => p0.rankingScore,
592-
// 'rankingScore',
593-
// isNotNull,
594-
// )
595-
// .having(
596-
// (p0) => p0.rankingScoreDetails,
597-
// 'rankingScoreDetails',
598-
// rankingScoreDetailsMatcher,
599-
// )
600-
// .having(
601-
// (p0) => p0.vectors, 'vectors', allOf(isNotNull, isNotEmpty))
602-
// .having((p0) => p0.semanticScore, 'semanticScore', isNull),
603-
// ),
604-
// );
605-
// });
606591
// });
607592

608593
test('search code samples', () async {

0 commit comments

Comments
 (0)