Skip to content

Commit 289e398

Browse files
committed
rename + doc
1 parent 69887b4 commit 289e398

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/lib/search/mem_index.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ class InMemoryPackageIndex {
2828
late final TokenIndex<String> _readmeIndex;
2929
late final TokenIndex<IndexedApiDocPage> _apiSymbolIndex;
3030
late final _scorePool = ScorePool(_packageNameIndex._packageNames);
31-
final _tagDocumentIndexes = <String, List<int>>{};
31+
32+
/// Maps the tag strings to a list of document index values
33+
/// (`PackageDocument doc.tags -> List<_documents.indexOf(doc)>`).
34+
final _tagDocumentIndices = <String, List<int>>{};
3235
final _documentTagIds = <List<int>>[];
3336

3437
/// Adjusted score takes the overall score and transforms
@@ -63,7 +66,7 @@ class InMemoryPackageIndex {
6366
// transform tags into numberical IDs
6467
final tagIds = <int>[];
6568
for (final tag in doc.tags) {
66-
_tagDocumentIndexes.putIfAbsent(tag, () => []).add(i);
69+
_tagDocumentIndices.putIfAbsent(tag, () => []).add(i);
6770
}
6871
tagIds.sort();
6972
_documentTagIds.add(tagIds);
@@ -159,7 +162,7 @@ class InMemoryPackageIndex {
159162
query.tagsPredicate.appendPredicate(query.parsedQuery.tagsPredicate);
160163
if (combinedTagsPredicate.isNotEmpty) {
161164
for (final entry in combinedTagsPredicate.entries) {
162-
final docIndexes = _tagDocumentIndexes[entry.key];
165+
final docIndexes = _tagDocumentIndices[entry.key];
163166

164167
if (entry.value) {
165168
// predicate is required, zeroing the gaps between index values

0 commit comments

Comments
 (0)