Created
February 23, 2026 23:03
-
-
Save davis/48e4e3d4650331648d2fc05105496d99 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/modules/Search/src/QueryCard/Resource/QueryCard.php b/modules/Search/src/QueryCard/Resource/QueryCard.php | |
| index efa6cf6f210c..3fe1f161d1b8 100644 | |
| --- a/modules/Search/src/QueryCard/Resource/QueryCard.php | |
| +++ b/modules/Search/src/QueryCard/Resource/QueryCard.php | |
| @@ -227,4 +227,5 @@ public function getDigitalPhysicalAsV2Value(): string | |
| { | |
| return $this->getDigitalPhysicalClassification()->toV2Value(); | |
| } | |
| + | |
| } | |
| diff --git a/phplib/EtsyConfig/development.php b/phplib/EtsyConfig/development.php | |
| index a5d2d38baf3e..d766f975d0df 100644 | |
| --- a/phplib/EtsyConfig/development.php | |
| +++ b/phplib/EtsyConfig/development.php | |
| @@ -49132,6 +49132,7 @@ | |
| 'search.query_understanding.2020_q3.adult_intent_safe_search_Wrapper_NE' => [50, 100], | |
| 'search.query_understanding.2020_q3.adult_intent_safe_search_NE' => [50, 100], | |
| // smu flags: newer flags go on top! | |
| + 'search.smu.auto_filter_physical_only' => [0, 100], | |
| 'search.smu.genir_autosuggest_web_v0' => [0, 100], | |
| 'search.smu.smu_ios_trending_queries_in_interstitial' => [0, 100], | |
| 'search.smu.parallelize_query_card' => [0, 100], | |
| @@ -68956,6 +68957,12 @@ | |
| ] | |
| ], | |
| 'smu' => [ | |
| + 'auto_filter_physical_only' => [ | |
| + FC::OWNERS => ['#search-mission-understanding', '@davis'], | |
| + FC::DESCRIPTION => 'Filter out digital items for queries that are classified as Physical only (DPCv3)', | |
| + FC::ENABLED => 100, | |
| + FC::PUBLIC_URL_OVERRIDE => true, | |
| + ], | |
| 'genir_autosuggest_web_v0' => [ | |
| FC::DESCRIPTION => 'GenIR Autosuggest using ReactorRecs Lite with BART SFT/DPO models', | |
| FC::ENABLED => [ | |
| diff --git a/phplib/Search2/Eligibility.php b/phplib/Search2/Eligibility.php | |
| index 7aa952135d76..5d8a21d48b44 100644 | |
| --- a/phplib/Search2/Eligibility.php | |
| +++ b/phplib/Search2/Eligibility.php | |
| @@ -4413,4 +4413,12 @@ public function isEligibleForBFCache(Search2_RequestParameters_Base $params): bo | |
| return $params->isMobile() && $params->isSearchPage() && Feature::isEnabled(self::BFCACHE_MWEB_SEARCH_PAGE); | |
| } | |
| + public function isEligibleForAutoFilterPhysicalOnly(Search2_RequestParameters_Base $params): bool { | |
| + return $this->isEligibleForSearchFeature( | |
| + params: $params, | |
| + feature_flag: 'ranking/search.smu.auto_filter_physical_only', | |
| + placements: [DataType_Search_Placement::WEB_SEARCH_GRID], | |
| + platforms: [Search2_Enum_Platform::DESKTOP, Search2_Enum_Platform::MWEB], | |
| + ); | |
| + } | |
| } | |
| diff --git a/phplib/Search2/Redirects.php b/phplib/Search2/Redirects.php | |
| index 492134f5202e..2814c086f219 100644 | |
| --- a/phplib/Search2/Redirects.php | |
| +++ b/phplib/Search2/Redirects.php | |
| @@ -282,7 +282,9 @@ public static function getRedirectUrlFromResponses( | |
| return $last_page_url; | |
| } else if ($without_merch_filter_url = static::getWithoutMerchAutofilter($request_params, $result_count, $eligibility)) { | |
| return $without_merch_filter_url; | |
| - } | |
| + } else if ($instant_download_disabled_url = self::getInstantDownloadDisabledUrl($request_params, $eligibility)) { | |
| + return $instant_download_disabled_url; | |
| + } | |
| return null; | |
| } | |
| @@ -631,6 +633,45 @@ private static function getWithoutMerchAutofilter( | |
| ); | |
| } | |
| + private static function getInstantDownloadDisabledUrl( | |
| + Search2_RequestParameters_ListingSearch $params, | |
| + ?Search2_Eligibility $eligibility = new Search2_Eligibility() | |
| + ): ?Etsy_Url { | |
| + error_log(print_r('redirects happened?', true)); | |
| + error_log(print_r(self::redirectTypeAlreadyOccurred($params, self::DIGITAL_PHYSICAL_REDIRECT), true)); | |
| + error_log(print_r('class = ', true)); | |
| + error_log(print_r($params->query_card?->getDigitalPhysicalClassification(), true)); | |
| + error_log(print_r('classmatch?', true)); | |
| + error_log(print_r($params->query_card?->getDigitalPhysicalClassification() !== Search\QueryCard\Classification\DigitalPhysicalV3Class::PHYSICAL_ONLY, true)); | |
| + error_log(print_r('mlt?', true)); | |
| + error_log(print_r($params->isMoreLikeThisRedirect(), true)); | |
| + error_log(print_r('feature check?', true)); | |
| + error_log(print_r($eligibility->isEligibleForAutoFilterPhysicalOnly($params), true)); | |
| + if ( | |
| + self::redirectTypeAlreadyOccurred($params, self::DIGITAL_PHYSICAL_REDIRECT) || | |
| + $params->query_card?->getDigitalPhysicalClassification() !== Search\QueryCard\Classification\DigitalPhysicalV3Class::PHYSICAL_ONLY || | |
| + $params->isMoreLikeThisRedirect() || | |
| + !$eligibility->isEligibleForAutoFilterPhysicalOnly($params) | |
| + ) { | |
| + error_log(print_r('shouldnt redir', true)); | |
| + return null; | |
| + } | |
| + | |
| + error_log(print_r('redirecting', true)); | |
| + | |
| + $url_params = ['instant_download' => false]; | |
| + | |
| + $params->setRedirectType(self::DIGITAL_PHYSICAL_REDIRECT); | |
| + return new Etsy_Url( | |
| + Search2_UrlUtil::relativeUrlWithParams( | |
| + array_merge( | |
| + self::getRedirectParamsAsArray($params), | |
| + $url_params | |
| + ) | |
| + ) | |
| + ); | |
| + } | |
| + | |
| /** | |
| * @param array|null $keys_to_clear - array of keys to clear, otherwise clear Search2_UrlUtil::$keys_to_clear | |
| */ | |
| diff --git a/phplib/Search2/RequestParameters/ListingSearch.php b/phplib/Search2/RequestParameters/ListingSearch.php | |
| index 1e9b3f89160e..413fbc324ae9 100644 | |
| --- a/phplib/Search2/RequestParameters/ListingSearch.php | |
| +++ b/phplib/Search2/RequestParameters/ListingSearch.php | |
| @@ -19,8 +19,6 @@ class Search2_RequestParameters_ListingSearch extends Search2_RequestParameters_ | |
| protected $is_query_result_count_gt_50k; | |
| - protected bool $is_direct_query = false; | |
| - | |
| protected ?Api_Resource_Public_Taxonomy_Node $qtc_v5_seller_node = null; | |
| protected ?Api_Resource_Public_Taxonomy_Node $qtc_v5_buyer_node = null; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment