@@ -40,7 +40,6 @@ class InMemoryPackageIndex {
4040 late final List <IndexedPackageHit > _overallOrderedHits;
4141 late final List <IndexedPackageHit > _createdOrderedHits;
4242 late final List <IndexedPackageHit > _updatedOrderedHits;
43- late final List <IndexedPackageHit > _popularityOrderedHits;
4443 late final List <IndexedPackageHit > _downloadsOrderedHits;
4544 late final List <IndexedPackageHit > _likesOrderedHits;
4645 late final List <IndexedPackageHit > _pointsOrderedHits;
@@ -116,8 +115,6 @@ class InMemoryPackageIndex {
116115 score: (doc) => doc.overallScore ?? 0.0 );
117116 _createdOrderedHits = _rankWithComparator (_compareCreated);
118117 _updatedOrderedHits = _rankWithComparator (_compareUpdated);
119- _popularityOrderedHits = _rankWithComparator (_comparePopularity,
120- score: (doc) => doc.popularityScore ?? 0 );
121118 _downloadsOrderedHits = _rankWithComparator (_compareDownloads,
122119 score: (doc) => doc.downloadCount.toDouble ());
123120 _likesOrderedHits = _rankWithComparator (_compareLikes,
@@ -271,9 +268,8 @@ class InMemoryPackageIndex {
271268 case SearchOrder .updated:
272269 indexedHits = _updatedOrderedHits.whereInScores (packageScores);
273270 break ;
271+ // ignore: deprecated_member_use
274272 case SearchOrder .popularity:
275- indexedHits = _popularityOrderedHits.whereInScores (packageScores);
276- break ;
277273 case SearchOrder .downloads:
278274 indexedHits = _downloadsOrderedHits.whereInScores (packageScores);
279275 break ;
@@ -315,7 +311,7 @@ class InMemoryPackageIndex {
315311 /// Update the overall score both on [PackageDocument] and in the [_adjustedOverallScores] map.
316312 void _updateOverallScores () {
317313 _adjustedOverallScores = _documents.map ((doc) {
318- final downloadScore = doc.downloadScore ?? doc.popularityScore ?? 0.0 ;
314+ final downloadScore = doc.downloadScore ?? 0.0 ;
319315 final likeScore = doc.likeScore ?? 0.0 ;
320316 final popularity = (downloadScore + likeScore) / 2 ;
321317 final points = doc.grantedPoints / math.max (1 , doc.maxPoints);
@@ -497,12 +493,6 @@ class InMemoryPackageIndex {
497493 return _compareUpdated (a, b);
498494 }
499495
500- int _comparePopularity (PackageDocument a, PackageDocument b) {
501- final x = - (a.popularityScore ?? 0.0 ).compareTo (b.popularityScore ?? 0.0 );
502- if (x != 0 ) return x;
503- return _compareUpdated (a, b);
504- }
505-
506496 int _compareDownloads (PackageDocument a, PackageDocument b) {
507497 final x = - a.downloadCount.compareTo (b.downloadCount);
508498 if (x != 0 ) return x;
0 commit comments