Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/lib/search/mem_index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class InMemoryPackageIndex {
/// The [BitArrayPool] does not reset the reused pool items, because initialization
/// depends on the presence of the [filterOnPackages] list.
void _resetBitArray(BitArray selected, List<String>? filterOnPackages) {
if (filterOnPackages != null && filterOnPackages.isNotEmpty) {
if (filterOnPackages != null) {
selected.clearAll();
for (final package in filterOnPackages) {
final index = _nameToIndex[package];
Expand Down
3 changes: 2 additions & 1 deletion app/lib/search/search_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ class ServiceSearchQuery {
isNaturalOrder &&
_hasNoOwnershipScope &&
!_isFlutterFavorite &&
(textMatchExtent ?? TextMatchExtent.api).shouldMatchApi();
(textMatchExtent ?? TextMatchExtent.api).shouldMatchApi() &&
packages == null;

/// Returns the validity status of the query.
QueryValidity evaluateValidity() {
Expand Down
5 changes: 2 additions & 3 deletions pkg/_pub_shared/lib/search/search_request_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ class SearchRequestData {
this.offset,
this.limit,
this.textMatchExtent,
List<String>? packages,
this.packages,
}) : query = _trimToNull(query),
publisherId = _trimToNull(publisherId),
packages = packages != null && packages.isNotEmpty ? packages : null;
publisherId = _trimToNull(publisherId);

factory SearchRequestData.fromJson(Map<String, dynamic> json) =>
_$SearchRequestDataFromJson(json);
Expand Down
11 changes: 8 additions & 3 deletions pkg/pub_integration/test/like_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,22 @@ void main() {

await page.gotoOrigin('/experimental?my-liked-search=1');

// checking search with my-liked packages - without any likes
await page.gotoOrigin('/packages?q=pkg+is:liked-by-me');
final info1 = await listingPageInfo(page);
expect(info1.packageNames, isEmpty);

await page.gotoOrigin('/packages/test_pkg');
expect(await getCountLabels(), ['0', '0', '']);

await page.click('.like-button-and-label--button');
await Future.delayed(Duration(seconds: 1));
expect(await getCountLabels(), ['1', '1', '']);

// checking search with my-liked packages
// checking search with my-liked packages - with the one liked package
await page.gotoOrigin('/packages?q=pkg+is:liked-by-me');
final info = await listingPageInfo(page);
expect(info.packageNames.toSet(), {'test_pkg'});
final info2 = await listingPageInfo(page);
expect(info2.packageNames.toSet(), {'test_pkg'});

// displaying all three
await page.gotoOrigin('/packages/test_pkg/score');
Expand Down