@@ -95,7 +95,6 @@ server.dart adds a small, prescriptive server (PicoServer) that can be configure
9595 expect (json.decode (json.encode (result)), {
9696 'timestamp' : isNotNull,
9797 'totalCount' : 1 ,
98- 'nameMatches' : ['async' ],
9998 'sdkLibraryHits' : [],
10099 'packageHits' : [
101100 {'package' : 'async' , 'score' : closeTo (0.71 , 0.01 )},
@@ -254,7 +253,6 @@ server.dart adds a small, prescriptive server (PicoServer) that can be configure
254253 expect (json.decode (json.encode (result)), {
255254 'timestamp' : isNotNull,
256255 'totalCount' : 2 ,
257- 'nameMatches' : ['http' ],
258256 'sdkLibraryHits' : [],
259257 'packageHits' : [
260258 {'package' : 'http' },
@@ -628,7 +626,7 @@ server.dart adds a small, prescriptive server (PicoServer) that can be configure
628626 ]
629627 },
630628 );
631- // exact name match without tags
629+ // exact name match without tags - promoted
632630 expect (
633631 (index.search (ServiceSearchQuery .parse (query: 'abc' ))).toJson (), {
634632 'timestamp' : isNotEmpty,
@@ -641,19 +639,29 @@ server.dart adds a small, prescriptive server (PicoServer) that can be configure
641639 {'package' : 'def' , 'score' : closeTo (0.85 , 0.01 )},
642640 ]
643641 });
644- // exact name match with tags
642+ // exact name match without tags - first anyway
643+ expect (
644+ (index.search (ServiceSearchQuery .parse (query: 'def' ))).toJson (), {
645+ 'timestamp' : isNotEmpty,
646+ 'totalCount' : 2 ,
647+ 'sdkLibraryHits' : [],
648+ 'packageHits' : [
649+ {'package' : 'def' , 'score' : closeTo (0.85 , 0.01 )},
650+ {'package' : 'abc' , 'score' : closeTo (0.70 , 0.01 )},
651+ ]
652+ });
653+ // absent exact name match with tags
645654 expect (
646655 (index.search (ServiceSearchQuery .parse (query: 'abc sdk:dart' )))
647656 .toJson (),
648657 {
649658 'timestamp' : isNotEmpty,
650659 'totalCount' : 2 ,
651- 'nameMatches' : ['abc' ],
652660 'sdkLibraryHits' : [],
653661 'packageHits' : [
654- // `abc` is at the first position, score is kept
655- {'package' : 'abc' , 'score' : closeTo (0.70 , 0.01 )},
662+ // `abc` is at the original position
656663 {'package' : 'def' , 'score' : closeTo (0.85 , 0.01 )},
664+ {'package' : 'abc' , 'score' : closeTo (0.70 , 0.01 )},
657665 ]
658666 });
659667 // absent exact name match with tags
@@ -662,12 +670,10 @@ server.dart adds a small, prescriptive server (PicoServer) that can be configure
662670 .toJson (),
663671 {
664672 'timestamp' : isNotEmpty,
665- 'totalCount' : 2 ,
666- 'nameMatches' : ['abc' ],
673+ 'totalCount' : 1 ,
667674 'sdkLibraryHits' : [],
668675 'packageHits' : [
669- // `abc` is at the first position, score is zero
670- {'package' : 'abc' , 'score' : 0.0 },
676+ // `abc` is absent
671677 {'package' : 'def' , 'score' : closeTo (0.85 , 0.01 )},
672678 ]
673679 });
0 commit comments