Skip to content

Commit 344745a

Browse files
authored
Remove topics match experiment. (#8742)
1 parent d56ba1b commit 344745a

File tree

7 files changed

+3
-63
lines changed

7 files changed

+3
-63
lines changed

app/lib/frontend/handlers/experimental.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import '../../shared/cookie_utils.dart';
99
typedef PublicFlag = ({String name, String description});
1010

1111
const _publicFlags = <PublicFlag>{
12-
(name: 'search-topics', description: 'Show matching topics when searching'),
12+
(name: 'example', description: 'Short description'),
1313
};
1414

1515
final _allFlags = <String>{
@@ -86,8 +86,6 @@ class ExperimentalFlags {
8686
return params;
8787
}
8888

89-
bool get isSearchTopicsEnabled => isEnabled('search-topics');
90-
9189
bool get isDarkModeDefault => isEnabled('dark-as-default');
9290

9391
String encodedAsCookie() => _enabled.join(':');

app/lib/frontend/templates/listing.dart

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'dart:math';
66

77
import 'package:_pub_shared/search/search_form.dart';
88
import 'package:collection/collection.dart';
9-
import 'package:pub_dev/frontend/request_context.dart';
109

1110
import '../../package/search_adapter.dart';
1211
import '../../search/search_service.dart';
@@ -52,9 +51,6 @@ String renderPkgIndexPage(
5251
messageFromBackend: searchResultPage.errorMessage,
5352
),
5453
nameMatches: _nameMatches(searchForm, searchResultPage.nameMatches),
55-
topicMatches: requestContext.experimentalFlags.isSearchTopicsEnabled
56-
? _topicMatches(searchForm, searchResultPage.topicMatches)
57-
: null,
5854
packageList: packageList(searchResultPage),
5955
pagination: searchResultPage.hasHit ? paginationNode(links) : null,
6056
openSections: openSections,
@@ -151,24 +147,3 @@ d.Node? _nameMatches(SearchForm form, List<String>? matches) {
151147
}),
152148
]);
153149
}
154-
155-
d.Node? _topicMatches(SearchForm form, List<String>? matches) {
156-
if (matches == null || matches.isEmpty) {
157-
return null;
158-
}
159-
final singular = matches.length == 1;
160-
final isExactNameMatch = singular && form.parsedQuery.text == matches.single;
161-
final nameMatchLabel = isExactNameMatch
162-
? 'Exact topic match: '
163-
: 'Matching ${singular ? 'topic' : 'topics'}: ';
164-
165-
return d.p(children: [
166-
d.text(nameMatchLabel),
167-
...matches.expandIndexed((i, name) {
168-
return [
169-
if (i > 0) d.text(', '),
170-
d.a(href: urls.searchUrl(q: 'topic:$name'), text: '#$name'),
171-
];
172-
}),
173-
]);
174-
}

app/lib/frontend/templates/views/pkg/index.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,16 @@ d.Node packageListingNode({
1414
required SearchForm searchForm,
1515
required d.Node listingInfo,
1616
required d.Node? nameMatches,
17-
required d.Node? topicMatches,
1817
required d.Node packageList,
1918
required d.Node? pagination,
2019
required Set<String>? openSections,
2120
}) {
22-
final matchHighlights = [
23-
if (nameMatches != null) nameMatches,
24-
if (topicMatches != null) topicMatches,
25-
];
2621
final innerContent = d.fragment([
2722
listingInfo,
28-
if (matchHighlights.isNotEmpty)
23+
if (nameMatches != null)
2924
d.div(
3025
classes: ['listing-highlight-block'],
31-
children: matchHighlights,
26+
child: nameMatches,
3227
),
3328
packageList,
3429
if (pagination != null) pagination,

app/lib/package/search_adapter.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class SearchAdapter {
4545
form,
4646
result.totalCount,
4747
nameMatches: result.nameMatches,
48-
topicMatches: result.topicMatches,
4948
sdkLibraryHits: result.sdkLibraryHits,
5049
packageHits:
5150
result.packageHits.map((h) => views[h.package]).nonNulls.toList(),
@@ -149,9 +148,6 @@ class SearchResultPage {
149148
/// would be considered as blocker for publishing).
150149
final List<String>? nameMatches;
151150

152-
/// Topic names that are exact name matches or are close to a known topic.
153-
final List<String>? topicMatches;
154-
155151
/// The hits from the SDK libraries.
156152
final List<SdkLibraryHit> sdkLibraryHits;
157153

@@ -169,7 +165,6 @@ class SearchResultPage {
169165
this.form,
170166
this.totalCount, {
171167
this.nameMatches,
172-
this.topicMatches,
173168
List<SdkLibraryHit>? sdkLibraryHits,
174169
List<PackageView>? packageHits,
175170
this.errorMessage,

app/lib/search/mem_index.dart

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -230,19 +230,6 @@ class InMemoryPackageIndex {
230230
);
231231

232232
final nameMatches = textResults?.nameMatches;
233-
List<String>? topicMatches;
234-
235-
if (parsedQueryText != null) {
236-
final parts = parsedQueryText
237-
.split(' ')
238-
.map((t) => canonicalTopics.aliasToCanonicalMap[t] ?? t)
239-
.toSet()
240-
.where(_topics.contains)
241-
.toList();
242-
if (parts.isNotEmpty) {
243-
topicMatches = parts;
244-
}
245-
}
246233

247234
List<IndexedPackageHit> indexedHits;
248235
switch (query.effectiveOrder ?? SearchOrder.top) {
@@ -306,7 +293,6 @@ class InMemoryPackageIndex {
306293
timestamp: clock.now().toUtc(),
307294
totalCount: totalCount,
308295
nameMatches: nameMatches,
309-
topicMatches: topicMatches,
310296
packageHits: packageHits,
311297
errorMessage: textResults?.errorMessage,
312298
);

app/lib/search/search_service.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,6 @@ class PackageSearchResult {
361361
/// would be considered as blocker for publishing).
362362
final List<String>? nameMatches;
363363

364-
/// Topic names that are exact name matches or close to the queried text.
365-
final List<String>? topicMatches;
366364
final List<SdkLibraryHit> sdkLibraryHits;
367365
final List<PackageHit> packageHits;
368366

@@ -376,7 +374,6 @@ class PackageSearchResult {
376374
required this.timestamp,
377375
required this.totalCount,
378376
this.nameMatches,
379-
this.topicMatches,
380377
List<SdkLibraryHit>? sdkLibraryHits,
381378
List<PackageHit>? packageHits,
382379
this.errorMessage,
@@ -396,7 +393,6 @@ class PackageSearchResult {
396393
}) : timestamp = clock.now().toUtc(),
397394
totalCount = 0,
398395
nameMatches = null,
399-
topicMatches = null,
400396
sdkLibraryHits = <SdkLibraryHit>[],
401397
packageHits = <PackageHit>[];
402398

@@ -416,7 +412,6 @@ class PackageSearchResult {
416412
timestamp: timestamp,
417413
totalCount: totalCount,
418414
nameMatches: nameMatches,
419-
topicMatches: topicMatches,
420415
sdkLibraryHits: sdkLibraryHits ?? this.sdkLibraryHits,
421416
packageHits: packageHits,
422417
errorMessage: errorMessage,

app/lib/search/search_service.g.dart

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

0 commit comments

Comments
 (0)