From 0f546b1aeaa8cdb9d78e4d458cd6770985cfdd81 Mon Sep 17 00:00:00 2001 From: Ramon Date: Tue, 12 Oct 2021 09:08:49 -0300 Subject: [PATCH 01/34] Check if Elasticsearh is used post group tests --- tests/php/indexables/TestPost.php | 174 +++++++++++++++++++++++++++++- 1 file changed, 170 insertions(+), 4 deletions(-) diff --git a/tests/php/indexables/TestPost.php b/tests/php/indexables/TestPost.php index 9000001d48..854cc81d27 100644 --- a/tests/php/indexables/TestPost.php +++ b/tests/php/indexables/TestPost.php @@ -164,6 +164,7 @@ public function testPaginationWithOffset() { ) ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, count( $query->posts ) ); $this->assertEquals( 'two', $query->posts[0]->post_title ); } @@ -193,7 +194,7 @@ public function testWPQuerySearchContent() { $query = new \WP_Query( $args ); - $this->assertTrue( ! empty( $this->fired_actions['ep_wp_query_search'] ) ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 2 ); $this->assertEquals( $query->found_posts, 2 ); @@ -245,7 +246,7 @@ public function testWPQuerySearchTitle() { $query = new \WP_Query( $args ); - $this->assertTrue( ! empty( $this->fired_actions['ep_wp_query_search'] ) ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 3 ); $this->assertEquals( $query->found_posts, 3 ); @@ -405,6 +406,8 @@ public function testPostTermSyncHierarchyMultipleLevelQuery() { add_action( 'ep_wp_query_search', array( $this, 'action_wp_query_search' ), 10, 0 ); $query = new \WP_Query( array( 's' => '#findme' ) ); + $this->assertTrue( $query->elasticsearch_success ); + $this->assertNotNull( $query->posts[0] ); $this->assertNotNull( $query->posts[0]->terms ); $post = $query->posts[0]; @@ -451,6 +454,7 @@ public function testPostImplicitTaxonomyQueryCustomTax() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 1 ); $this->assertEquals( $query->found_posts, 1 ); } @@ -481,6 +485,7 @@ public function testPostImplicitTaxonomyQueryCategoryName() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 1 ); $this->assertEquals( $query->found_posts, 1 ); } @@ -510,6 +515,7 @@ public function testPostImplicitTaxonomyQueryTag() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 1 ); $this->assertEquals( $query->found_posts, 1 ); } @@ -539,7 +545,7 @@ public function testWPQuerySearchExcerpt() { $query = new \WP_Query( $args ); - $this->assertTrue( ! empty( $this->fired_actions['ep_wp_query_search'] ) ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 1 ); $this->assertEquals( $query->found_posts, 1 ); @@ -571,6 +577,7 @@ public function testPagination() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, count( $query->posts ) ); $this->assertEquals( 3, $query->found_posts ); @@ -585,6 +592,7 @@ public function testPagination() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, count( $query->posts ) ); $this->assertEquals( 3, $query->found_posts ); @@ -599,6 +607,7 @@ public function testPagination() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, count( $query->posts ) ); $this->assertEquals( 3, $query->found_posts ); @@ -613,6 +622,7 @@ public function testPagination() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 0, $query->post_count ); $this->assertEquals( 0, count( $query->posts ) ); $this->assertEquals( 3, $query->found_posts ); @@ -662,6 +672,7 @@ public function testTaxQuerySlug() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -713,6 +724,7 @@ public function testTaxQueryOrRelation() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -768,6 +780,7 @@ public function testTaxQueryTermId() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); @@ -783,6 +796,7 @@ public function testTaxQueryTermId() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -833,6 +847,7 @@ public function testTaxQueryTermName() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -876,6 +891,7 @@ public function testCategoryNameQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -902,6 +918,7 @@ public function testPostInQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -928,6 +945,7 @@ public function testPostNotInQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -956,6 +974,7 @@ public function testCategoryNotInQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -984,6 +1003,7 @@ public function testTagNotInQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -1020,6 +1040,7 @@ public function testAuthorIDQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -1063,6 +1084,7 @@ public function testAuthorNameQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); @@ -1072,6 +1094,7 @@ public function testAuthorNameQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -1106,6 +1129,7 @@ public function testPostTypeQueryPage() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -1141,6 +1165,7 @@ public function testPostTypeQueryPost() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -1170,6 +1195,7 @@ public function testNoPostTypeSearchQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); } @@ -1204,6 +1230,7 @@ public function testPostStatusQueryPublish() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -1240,6 +1267,7 @@ public function testPostStatusQueryDraft() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); @@ -1281,6 +1309,7 @@ public function testPostStatusQueryMulti() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); @@ -1341,6 +1370,7 @@ public function testAttachmentQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); @@ -1373,6 +1403,7 @@ public function testNoPostTypeNonSearchQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -1407,6 +1438,7 @@ public function testAnyPostTypeQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); } @@ -1430,6 +1462,7 @@ public function testSearchMetaInPostObject() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, count( $query->posts[0]->meta['test_key'] ) ); @@ -1459,6 +1492,7 @@ public function testSearchMetaQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); @@ -1473,6 +1507,7 @@ public function testSearchMetaQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -1510,6 +1545,7 @@ public function testSearchTaxQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); @@ -1562,6 +1598,7 @@ public function testSearchAuthorQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); @@ -1632,6 +1669,7 @@ public function testAdvancedQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -1657,6 +1695,7 @@ public function testSearchPostTitleOrderbyQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); $this->assertEquals( 'ordertest 333', $query->posts[0]->post_title ); @@ -1685,6 +1724,7 @@ public function testSearchPostMetaStringOrderbyQueryAsc() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); $this->assertEquals( 'ordertest 111', $query->posts[0]->post_title ); @@ -1713,6 +1753,7 @@ public function testSearchPostMetaStringOrderbyQueryAscArray() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); $this->assertEquals( 'ordertest 111', $query->posts[0]->post_title ); @@ -1759,6 +1800,7 @@ public function testSearchPostMetaStringOrderbyQueryAdvanced() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); $this->assertEquals( 'ordertest 333', $query->posts[0]->post_title ); @@ -1821,6 +1863,8 @@ public function testAuthorLoginOrderbyQueryAsc() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); + $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); @@ -1884,6 +1928,8 @@ public function testAuthorDisplayNameOrderbyQueryAsc() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); + $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); @@ -1914,6 +1960,7 @@ public function testSearchPostMetaNumOrderbyQueryAsc() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 4, $query->post_count ); $this->assertEquals( 4, $query->found_posts ); $this->assertEquals( 'ordertest 111', $query->posts[0]->post_title ); @@ -1969,6 +2016,7 @@ public function testSearchTaxNameOrderbyQueryAsc() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 4, $query->post_count ); $this->assertEquals( 4, $query->found_posts ); $this->assertEquals( 'ordertest 111', $query->posts[0]->post_title ); @@ -1999,6 +2047,7 @@ public function testSearchPostMetaNumOrderbyQueryDesc() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 4, $query->post_count ); $this->assertEquals( 4, $query->found_posts ); $this->assertEquals( 'ordertest 111', $query->posts[3]->post_title ); @@ -2053,6 +2102,7 @@ public function testSearchPostMetaNumMultipleOrderbyQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 4, $query->post_count ); $this->assertEquals( 4, $query->found_posts ); $this->assertEquals( 'ordertest 111', $query->posts[0]->post_title ); @@ -2089,6 +2139,7 @@ public function testSearchPostDateOrderbyQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); $this->assertEquals( 'Ordertest 222', $query->posts[0]->post_title ); @@ -2122,6 +2173,7 @@ public function testSearchPostDateOrderbyQueryEPIntegrate() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); $this->assertEquals( 'Ordertest 222', $query->posts[0]->post_title ); @@ -2175,6 +2227,7 @@ public function testSearchRelevanceOrderbyQueryAdvanced() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 6, $query->post_count ); $this->assertEquals( 6, $query->found_posts ); @@ -2211,6 +2264,7 @@ public function testSearchRelevanceOrderbyQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); $this->assertEquals( 'ordertest', $query->posts[0]->post_title ); @@ -2240,6 +2294,7 @@ public function testSearchPostNameOrderbyQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); $this->assertEquals( 'postname-ordertest-111', $query->posts[0]->post_name ); @@ -2271,6 +2326,7 @@ public function testSearchDefaultOrderbyQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); $this->assertEquals( 'ordertest', $query->posts[0]->post_title ); @@ -2304,6 +2360,7 @@ public function testSearchDefaultOrderbyASCOrderQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); $this->assertEquals( 'ordertestt', $query->posts[0]->post_title ); @@ -2332,6 +2389,8 @@ public function testRandOrderby() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); + /** * Since it's test for random order, can't check against exact post ID or content * but only found posts and post count. @@ -2395,6 +2454,7 @@ public function testEmptySearchString() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -2423,6 +2483,7 @@ public function testMetaQueryEquals() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -2452,6 +2513,7 @@ public function testMetaQueryNotEquals() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -2480,6 +2542,7 @@ public function testMetaQueryExists() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -2508,6 +2571,7 @@ public function testMetaQueryNotExists() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -2538,6 +2602,7 @@ public function testMetaQueryGreaterThan() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -2569,6 +2634,7 @@ public function testMetaQueryBetween() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -2599,6 +2665,7 @@ public function testMetaQueryGreaterThanEqual() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -2629,6 +2696,7 @@ public function testMetaQueryLessThan() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -2659,6 +2727,7 @@ public function testMetaQueryLessThanEqual() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -2706,6 +2775,7 @@ public function testMetaQueryOrRelation() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -2757,6 +2827,7 @@ public function testMetaQueryAdvanced() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -2788,6 +2859,7 @@ public function testMetaQueryLike() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertTrue( isset( $query->posts[0]->elasticsearch ) ); $this->assertEquals( 3, $query->post_count ); $this->assertEquals( 3, $query->found_posts ); @@ -2818,6 +2890,7 @@ public function testMetaQueryNotLike() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertTrue( isset( $query->posts[0]->elasticsearch ) ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); @@ -2866,6 +2939,7 @@ public function testMetaQueryMultipleArray() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); @@ -2894,6 +2968,7 @@ public function testMetaQueryMultipleArray() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -2939,7 +3014,7 @@ public function testExcludeFromSearch() { $query = new \WP_Query( $args ); - $this->assertTrue( ! empty( $this->fired_actions['ep_wp_query_search'] ) ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 2 ); $this->assertEquals( $query->found_posts, 2 ); @@ -2981,6 +3056,7 @@ public function testNoAvailablePostTypesToSearch() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 0, $query->post_count ); $this->assertEquals( 0, $query->found_posts ); @@ -3007,6 +3083,7 @@ public function testCacheResultsDefaultOff() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertFalse( $query->query_vars['cache_results'] ); } @@ -3028,6 +3105,7 @@ public function testCacheResultsOn() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertTrue( $query->query_vars['cache_results'] ); } @@ -3051,6 +3129,8 @@ public function testCachedResultIsInCache() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); + $cache = wp_cache_get( $query->posts[0]->ID, 'posts' ); $this->assertTrue( ! empty( $cache ) ); @@ -3075,6 +3155,8 @@ public function testCachedResultIsNotInCache() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); + $cache = wp_cache_get( $query->posts[0]->ID, 'posts' ); $this->assertTrue( empty( $cache ) ); @@ -3349,6 +3431,7 @@ public function testMetaKeyQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); @@ -3374,6 +3457,7 @@ public function testMetaKeyQueryNum() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); @@ -3411,6 +3495,7 @@ public function testMetaKeyQueryMix() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); @@ -3444,6 +3529,7 @@ public function testMetaValueTypeQueryNumeric() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); @@ -3461,6 +3547,7 @@ public function testMetaValueTypeQueryNumeric() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); @@ -3478,6 +3565,7 @@ public function testMetaValueTypeQueryNumeric() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); @@ -3511,6 +3599,7 @@ public function testMetaValueTypeQueryDecimal() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); @@ -3528,6 +3617,7 @@ public function testMetaValueTypeQueryDecimal() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -3560,6 +3650,7 @@ public function testMetaValueTypeQueryChar() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -3590,6 +3681,7 @@ public function testMetaValueTypeQueryDate() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $args = array( @@ -3606,6 +3698,7 @@ public function testMetaValueTypeQueryDate() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); } @@ -3635,6 +3728,7 @@ public function testMetaValueTypeQueryTime() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $args = array( @@ -3651,6 +3745,7 @@ public function testMetaValueTypeQueryTime() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); } @@ -3679,6 +3774,7 @@ public function testMetaValueTypeQueryDatetime() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $args = array( @@ -3695,6 +3791,7 @@ public function testMetaValueTypeQueryDatetime() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $args = array( @@ -3711,6 +3808,7 @@ public function testMetaValueTypeQueryDatetime() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); } @@ -3739,6 +3837,7 @@ public function testPostParentQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -3769,10 +3868,14 @@ public function testPostNameInQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); + $args['post_name__in'] = array( 'findme-name-in' ); $query2 = new \WP_Query( $args ); + $this->assertTrue( $query2->elasticsearch_success ); + $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); $this->assertEquals( 1, $query2->post_count ); @@ -3817,6 +3920,7 @@ public function testTaxQueryNotIn() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); @@ -3839,6 +3943,7 @@ public function testTaxQueryNotIn() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -3881,6 +3986,7 @@ public function testTaxQueryExists() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); @@ -3903,6 +4009,7 @@ public function testTaxQueryExists() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -3945,6 +4052,7 @@ public function testTaxQueryNotExists() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -3995,6 +4103,8 @@ public function testPostMimeTypeQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); + $attachment_names = wp_list_pluck( $query->posts, 'post_name' ); $this->assertEquals( 3, $query->post_count ); @@ -4012,6 +4122,8 @@ public function testPostMimeTypeQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); + $attachment_names = wp_list_pluck( $query->posts, 'post_name' ); $this->assertEquals( 1, $query->post_count ); @@ -4030,6 +4142,8 @@ public function testPostMimeTypeQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); + $attachment_names = wp_list_pluck( $query->posts, 'post_name' ); $this->assertEquals( 3, $query->found_posts ); @@ -4050,6 +4164,8 @@ public function testPostMimeTypeQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); + $attachment_names = wp_list_pluck( $query->posts, 'post_name' ); $this->assertEquals( 4, $query->found_posts ); @@ -4070,6 +4186,8 @@ public function testPostMimeTypeQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); + $attachment_names = wp_list_pluck( $query->posts, 'post_name' ); $this->assertEquals( 1, $query->found_posts ); @@ -4115,6 +4233,7 @@ public function testTaxQueryOperatorIn() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); @@ -4132,6 +4251,7 @@ public function testTaxQueryOperatorIn() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -4176,6 +4296,7 @@ public function testTaxQueryOperatorAnd() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -4225,6 +4346,7 @@ public function testCustomTaxonomyPublic() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 1 ); $this->assertEquals( $query->found_posts, 1 ); $this->assertTrue( isset( $query->posts[0]->elasticsearch ) ); @@ -4289,6 +4411,8 @@ public function testSimpleDateMonthNum() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 5, $query->post_count ); $this->assertEquals( 5, $query->found_posts ); @@ -4299,6 +4423,8 @@ public function testSimpleDateMonthNum() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 1 ); $this->assertEquals( $query->found_posts, 1 ); } @@ -4318,6 +4444,8 @@ public function testSimpleDateDay() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 1 ); $this->assertEquals( $query->found_posts, 1 ); } @@ -4350,6 +4478,8 @@ public function testDateQueryBeforeAfter() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 2 ); $this->assertEquals( $query->found_posts, 2 ); } @@ -4379,6 +4509,7 @@ public function testDateQueryMultiColumn() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 4 ); $this->assertEquals( $query->found_posts, 4 ); } @@ -4408,6 +4539,8 @@ public function testDateQueryMultiColumnInclusive() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 1 ); $this->assertEquals( $query->found_posts, 1 ); } @@ -4442,6 +4575,7 @@ public function testDateQueryWorkingHours() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 5 ); $this->assertEquals( $query->found_posts, 5 ); } @@ -4471,6 +4605,8 @@ public function testDateQueryMultiColumnNotInclusive() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 0 ); $this->assertEquals( $query->found_posts, 0 ); } @@ -4496,6 +4632,8 @@ public function testDateQuerySimple() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 1 ); $this->assertEquals( $query->found_posts, 1 ); } @@ -4631,6 +4769,8 @@ public function testDateQueryBetween() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 5 ); $this->assertEquals( $query->found_posts, 5 ); } @@ -4655,6 +4795,8 @@ public function testDateQueryNotBetween() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 8 ); $this->assertEquals( $query->found_posts, 8 ); } @@ -4680,6 +4822,7 @@ public function testDateQueryShortBetween() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 1, $query->post_count ); $this->assertEquals( 1, $query->found_posts ); } @@ -4726,6 +4869,8 @@ public function testDateQueryCompare() { $this->assertSame( 10, $filter['and']['bool']['must'][0]['term']['date_terms.week'] ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 4 ); $this->assertEquals( $query->found_posts, 4 ); @@ -4797,6 +4942,8 @@ public function testDateQueryInclusiveTypeMix() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 2 ); $this->assertEquals( $query->found_posts, 2 ); } @@ -4827,6 +4974,8 @@ public function testDateQueryExclusiveTypeMix() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( $query->post_count, 0 ); $this->assertEquals( $query->found_posts, 0 ); } @@ -4859,6 +5008,8 @@ public function testDateQueryCompare2() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -4883,6 +5034,8 @@ public function testDateQueryWeekdayRange() { ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 9, $query->post_count ); $this->assertEquals( 9, $query->found_posts ); } @@ -4910,6 +5063,9 @@ public function testQueryWithIsSearch() { 's' => 'findme', ); $query = new \WP_Query( $args ); + + $this->assertTrue( $query->elasticsearch_success ); + $check = ElasticPress\Indexables::factory()->get( 'post' )->elasticpress_enabled( $query ); $this->assertTrue( $check ); } @@ -4972,6 +5128,7 @@ public function testNestedTaxQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, count( $query->posts ) ); } @@ -5009,6 +5166,9 @@ public function testTagSlugQuery() { $query1 = new \WP_Query( $query1_args ); $query2 = new \WP_Query( $query2_args ); + $this->assertTrue( $query1->elasticsearch_success ); + $this->assertTrue( $query2->elasticsearch_success ); + $this->assertTrue( isset( $query1->posts[0]->elasticsearch ) ); $this->assertTrue( isset( $query2->posts[0]->elasticsearch ) ); @@ -5059,6 +5219,7 @@ public function testTagQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); @@ -5077,6 +5238,7 @@ public function testTagQuery() { $query = new \WP_Query( $args ); + $this->assertTrue( $query->elasticsearch_success ); $this->assertEquals( 2, $query->post_count ); $this->assertEquals( 2, $query->found_posts ); } @@ -6002,6 +6164,8 @@ public function testMaybeSwitchToBlog() { ] ); + $this->assertTrue( $query->elasticsearch_success ); + $blog_1_post = $query->posts[0]; $this->assertSame( $blog_1_id, $blog_1_post->site_id ); @@ -6021,6 +6185,8 @@ public function testMaybeSwitchToBlog() { ] ); + $this->assertTrue( $query->elasticsearch_success ); + $blog_2_post = $query->posts[0]; $this->assertSame( $blog_2_id, $blog_2_post->site_id ); From 0ea4b682f4150d8177449dede535f650ab88fc2c Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Tue, 2 Nov 2021 10:51:38 -0600 Subject: [PATCH 02/34] Force fetching ep_wpcli_sync_interrupted transient from remote to allow for more reliable remote interruptio --- includes/classes/Command.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/classes/Command.php b/includes/classes/Command.php index 3fb902668a..83bad7ae3f 100644 --- a/includes/classes/Command.php +++ b/includes/classes/Command.php @@ -1793,7 +1793,11 @@ public function custom_get_transient( $pre_transient, $transient ) { global $wpdb; if ( wp_using_ext_object_cache() ) { - $should_interrupt_sync = wp_cache_get( $transient, 'transient' ); + /** + * When external object cache is used we need to make sure to force a remote fetch, + * so that the value from the local memory is discarded. + */ + $should_interrupt_sync = wp_cache_get( $transient, 'transient', true ); } else { $options = $wpdb->options; From c5fde61ac9c36002d583c614f722a9ec9914ebb8 Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Tue, 2 Nov 2021 12:41:35 -0600 Subject: [PATCH 03/34] Remove duplicate orderby for users query --- includes/classes/Indexable/User/User.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/classes/Indexable/User/User.php b/includes/classes/Indexable/User/User.php index 2c35275c58..0f66284552 100644 --- a/includes/classes/Indexable/User/User.php +++ b/includes/classes/Indexable/User/User.php @@ -728,11 +728,14 @@ public function query_db( $args ) { $args['order'] = 'desc'; } + $orderby_args = sanitize_sql_orderby( "{$args['orderby']} {$args['order']}" ); + $orderby = $orderby_args ? sprintf( 'ORDER BY %s', $orderby_args ) : ''; + /** * WP_User_Query doesn't let us get users across all blogs easily. This is the best * way to do that. */ - $objects = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS ID FROM {$wpdb->users} ORDER BY %s %s LIMIT %d, %d", $args['orderby'], $args['orderby'], (int) $args['offset'], (int) $args['number'] ) ); + $objects = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS ID FROM {$wpdb->users} {$orderby} LIMIT %d, %d", (int) $args['offset'], (int) $args['number'] ) ); return [ 'objects' => $objects, From 060e3be597a71b831fbc5b238c1793edf1f9575d Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Tue, 2 Nov 2021 12:59:00 -0600 Subject: [PATCH 04/34] Fix linting issue --- includes/classes/Indexable/User/User.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/classes/Indexable/User/User.php b/includes/classes/Indexable/User/User.php index 0f66284552..e93beb648a 100644 --- a/includes/classes/Indexable/User/User.php +++ b/includes/classes/Indexable/User/User.php @@ -735,6 +735,7 @@ public function query_db( $args ) { * WP_User_Query doesn't let us get users across all blogs easily. This is the best * way to do that. */ + // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared $objects = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS ID FROM {$wpdb->users} {$orderby} LIMIT %d, %d", (int) $args['offset'], (int) $args['number'] ) ); return [ From dc9eea2e592ea087c1c235fa9d59148dfd2f3648 Mon Sep 17 00:00:00 2001 From: Vasken Hauri Date: Tue, 2 Nov 2021 15:56:16 -0700 Subject: [PATCH 05/34] Update readme.md to include reference to the support page --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9355997a1a..428713a97b 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ ElasticPress, a fast and flexible search and query engine for WordPress, enables ElasticPress has an in depth documentation site. [Visit the docs ☞](http://10up.github.io/ElasticPress/) +ElasticPress FAQs and tutorials can be found on our support site. [Visit the support site ☞](https://elasticpress.zendesk.com/hc/en-us) + ## Requirements * [Elasticsearch](https://www.elastic.co) 5.0+ **ElasticSearch max version supported: 7.9** From d4bff90582ab719bd28e538b88ae88576b3203f0 Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Thu, 4 Nov 2021 15:26:46 -0600 Subject: [PATCH 06/34] When using default max result window value for size, we should account for offsets --- includes/classes/Indexable/Comment/Comment.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/classes/Indexable/Comment/Comment.php b/includes/classes/Indexable/Comment/Comment.php index a96b5549f5..d6ca3297ec 100644 --- a/includes/classes/Indexable/Comment/Comment.php +++ b/includes/classes/Indexable/Comment/Comment.php @@ -85,6 +85,9 @@ public function format_args( $query_vars ) { */ if ( isset( $query_vars['offset'] ) ) { $formatted_args['from'] = (int) $query_vars['offset']; + if ( empty( $query_vars['number'] ) ) { + $formatted_args['size'] -= (int) $formatted_args['from']; + } } /** From 0fb7b99bcb62bc35ac293a391928dfc2f5a4679d Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Fri, 5 Nov 2021 11:46:25 -0300 Subject: [PATCH 07/34] Add notes about ES and WP min version bump --- CHANGELOG.md | 10 ++++++++-- README.md | 20 +++++++++++++++++--- readme.txt | 7 +++++-- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ced5190da..587a32d6d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,15 @@ All notable changes to this project will be documented in this file, per [the Ke ## [3.6.4] - 2021-10-26 -**Note that the upcoming ElasticPress 4.0.0 release will remove built assets from the `develop` branch, will replace `master` with `trunk`, will build a stable release version including built assets into a `stable` branch, and will include a build script should you want to build assets from a branch.** As such, please plan to update any references you have from `master` to either `stable` or `trunk` depending on whether you require built assets or not. +**Note that the upcoming ElasticPress 4.0.0 release will remove built assets from the `develop` branch, will replace `master` with `trunk`, ~~will build a stable release version including built assets into a `stable` branch,~~ will add a zip with the plugin and its built assets in the GitHub release page, and will include a build script should you want to build assets from a branch.** As such, please plan to update any references you have from `master` to ~~either `stable` or~~ `trunk` or to GitHub releases depending on whether you require built assets or not. -Official PHP support is currently 5.6+. Minimum PHP version for ElasticPress 4.0.0 will be 7.0+. +Minimum supported versions: + +||Current (3.6.4)|4.0.0| +|---|:---:|:---:| +|Elasticsearch|5.0+|5.2+| +|WordPress|3.7.1+|5.6+| +|PHP|5.6+|7.0+| ### Added - WP-CLI: New `get-mapping` command. Props [@tfrommen](https://github.com/tfrommen), [@felipeelia](https://github.com/felipeelia), and [@Rahmon](https://github.com/Rahmon) via [#2414](https://github.com/10up/ElasticPress/pull/2414). diff --git a/README.md b/README.md index 428713a97b..71d3f7d515 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,21 @@ [![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Tests Status](https://github.com/10up/ElasticPress/actions/workflows/test.yml/badge.svg?branch=develop)](https://github.com/10up/ElasticPress) [![Release Version](https://img.shields.io/github/release/10up/ElasticPress.svg)](https://github.com/10up/ElasticPress/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v5.8%20tested-success.svg) [![MIT License](https://img.shields.io/github/license/10up/ElasticPress.svg)](https://github.com/10up/ElasticPress/blob/develop/LICENSE.md) +* Check out the [ElasticPress Docs](http://10up.github.io/ElasticPress/) + **Please note:** master is the stable branch. -**Note that the upcoming ElasticPress 4.0.0 release will remove built assets from the `develop` branch, will replace `master` with `trunk`, will build a stable release version including built assets into a `stable` branch, and will include a build script should you want to build assets from a branch.** As such, please plan to update any references you have from `master` to either `stable` or `trunk` depending on whether you require built assets or not. +## Planned changes for 4.0.0 -**Search Algorithm Upgrade Notice:** Version 3.5 includes a revamp of the search algorithm. This is a backwards compatibility break. If you'd like to revert to the old search algorithm, you can use the following code: `add_filter( 'ep_search_algorithm_version', function() { return '3.4'; } );`. The new algorithm offers much more relevant search results and removes fuzziness which results in mostly unwanted results for most people. If you are hooking in and modifying the search query directly, it's possible this code might break and you might need to tweak it. +**Note that the upcoming ElasticPress 4.0.0 release will remove built assets from the `develop` branch, will replace `master` with `trunk`, ~~will build a stable release version including built assets into a `stable` branch,~~ will add a zip with the plugin and its built assets in the GitHub release page, and will include a build script should you want to build assets from a branch.** As such, please plan to update any references you have from `master` to ~~either `stable` or~~ `trunk` or to GitHub releases depending on whether you require built assets or not. -* Check out the [ElasticPress Docs](http://10up.github.io/ElasticPress/) +Minimum supported versions: + +||Current (3.6.4)|4.0.0| +|---|:---:|:---:| +|Elasticsearch|5.0+|5.2+| +|WordPress|3.7.1+|5.6+| +|PHP|5.6+|7.0+| ## Overview @@ -44,6 +52,12 @@ If you identify any errors or have an idea for improving the plugin, please [ope A complete listing of all notable changes to ElasticPress are documented in [CHANGELOG.md](https://github.com/10up/elasticpress/blob/develop/CHANGELOG.md). +## Upgrade notices + +### 3.5 + +**Search Algorithm Upgrade Notice:** Version 3.5 includes a revamp of the search algorithm. This is a backwards compatibility break. If you'd like to revert to the old search algorithm, you can use the following code: `add_filter( 'ep_search_algorithm_version', function() { return '3.4'; } );`. The new algorithm offers much more relevant search results and removes fuzziness which results in mostly unwanted results for most people. If you are hooking in and modifying the search query directly, it's possible this code might break and you might need to tweak it. + ## Contributing Please read [CODE_OF_CONDUCT.md](https://github.com/10up/elasticpress/blob/develop/CODE_OF_CONDUCT.md) for details on our code of conduct, [CONTRIBUTING.md](https://github.com/10up/elasticpress/blob/develop/CONTRIBUTING.md) for details on the process for submitting pull requests to us, and [CREDITS.md](https://github.com/10up/elasticpress/blob/develop/CREDITS.md) for a listing of maintainers of, contributors to, and libraries used by ElasticPress. diff --git a/readme.txt b/readme.txt index e2ddc86116..05e214ba44 100644 --- a/readme.txt +++ b/readme.txt @@ -48,9 +48,12 @@ Please refer to [Github](https://github.com/10up/ElasticPress) for detailed usag = 3.6.4 = -**Note that the upcoming ElasticPress 4.0.0 release will remove built assets from the `develop` branch, will replace `master` with `trunk`, will build a stable release version including built assets into a `stable` branch, and will include a build script should you want to build assets from a branch.** As such, please plan to update any references you have from `master` to either `stable` or `trunk` depending on whether you require built assets or not. +**Note that the upcoming ElasticPress 4.0.0 release will remove built assets from the `develop` branch, will replace `master` with `trunk`, ~~will build a stable release version including built assets into a `stable` branch,~~ will add a zip with the plugin and its built assets in the GitHub release page, and will include a build script should you want to build assets from a branch.** As such, please plan to update any references you have from `master` to ~~either `stable` or~~ `trunk` or to GitHub releases depending on whether you require built assets or not. -Official PHP support is currently 5.6+. Minimum PHP version for ElasticPress 4.0.0 will be 7.0+. +Minimum supported versions changes planned for ElasticPress 4.0.0: +* Elasticsearch: from 5.0+ to 5.2+. +* WordPress: from 3.7.1+ to 5.6+. +* PHP: from 5.6+ to 7.0+. Added: * WP-CLI: New `get-mapping` command. Props [@tfrommen](https://github.com/tfrommen), [@felipeelia](https://github.com/felipeelia), and [@Rahmon](https://github.com/Rahmon). From d515bb96c7f5d3797cbb9d45a66a48899df12d76 Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Fri, 5 Nov 2021 10:16:40 -0600 Subject: [PATCH 08/34] Add $type parameter to ep_do_intercept_request filter --- includes/classes/Elasticsearch.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/classes/Elasticsearch.php b/includes/classes/Elasticsearch.php index 527a35732d..f48827cba9 100644 --- a/includes/classes/Elasticsearch.php +++ b/includes/classes/Elasticsearch.php @@ -1155,9 +1155,10 @@ public function remote_request( $path, $args = [], $query_args = [], $type = nul * @param {array} $query Remote request arguments * @param {args} $args Request arguments * @param {int} $failures Number of failures + * @param {string} $type Type of request * @return {array} New request */ - $request = apply_filters( 'ep_do_intercept_request', new WP_Error( 400, 'No Request defined' ), $query, $args, $failures ); + $request = apply_filters( 'ep_do_intercept_request', new WP_Error( 400, 'No Request defined' ), $query, $args, $failures, $type ); } else { $request = wp_remote_request( $query['url'], $args ); // try the existing host to avoid unnecessary calls. } From 1ed057eb75c548b25b5d896102491b02d0894c6e Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Fri, 5 Nov 2021 12:05:15 -0600 Subject: [PATCH 09/34] Add since docblocks --- includes/classes/Elasticsearch.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/classes/Elasticsearch.php b/includes/classes/Elasticsearch.php index f48827cba9..ef2ec71eee 100644 --- a/includes/classes/Elasticsearch.php +++ b/includes/classes/Elasticsearch.php @@ -1151,6 +1151,8 @@ public function remote_request( $path, $args = [], $query_args = [], $type = nul * Filter intercepted request * * @hook ep_do_intercept_request + * @since 3.2.2 + * @since 4.0.0 added $type * @param {array} $request New remote request response * @param {array} $query Remote request arguments * @param {args} $args Request arguments From 374220fcd5f7175839c131ecfde774ab4f72108e Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Fri, 5 Nov 2021 17:15:29 -0300 Subject: [PATCH 10/34] Cache the post mapping version --- includes/classes/Indexable/Post/Post.php | 38 ++++++++++++++++++------ 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/includes/classes/Indexable/Post/Post.php b/includes/classes/Indexable/Post/Post.php index 867cbce1c8..ac973236cb 100644 --- a/includes/classes/Indexable/Post/Post.php +++ b/includes/classes/Indexable/Post/Post.php @@ -277,18 +277,36 @@ public function get_mapping_name() { * @return string|WP_Error|false $version */ public function determine_mapping_version() { - $index = $this->get_index_name(); - $mapping = Elasticsearch::factory()->get_mapping( $index ); + $version = get_transient( 'ep_post_mapping_version' ); - if ( empty( $mapping ) ) { - return new \WP_Error( 'ep_failed_mapping_version', esc_html__( 'Error while fetching the mapping version.', 'elasticpress' ) ); - } + if ( empty( $version ) ) { + $index = $this->get_index_name(); + $mapping = Elasticsearch::factory()->get_mapping( $index ); - if ( ! isset( $mapping[ $index ] ) ) { - return false; - } + if ( empty( $mapping ) ) { + return new \WP_Error( 'ep_failed_mapping_version', esc_html__( 'Error while fetching the mapping version.', 'elasticpress' ) ); + } - $version = $this->determine_mapping_version_based_on_existing( $mapping, $index ); + if ( ! isset( $mapping[ $index ] ) ) { + return false; + } + + $version = $this->determine_mapping_version_based_on_existing( $mapping, $index ); + + set_transient( + 'ep_post_mapping_version', + $version, + /** + * Filter the post mapping version cache expiration. + * + * @hook ep_post_mapping_version_cache_expiration + * @since 4.0.0 + * @param {int} $version Time in seconds for the transient expiration + * @return {int} New time + */ + apply_filters( 'ep_post_mapping_version_cache_expiration', DAY_IN_SECONDS ) + ); + } /** * Filter the mapping version for posts. @@ -328,6 +346,8 @@ public function put_mapping() { */ $mapping = apply_filters( 'ep_post_mapping', $mapping ); + delete_transient( 'ep_post_mapping_version' ); + return Elasticsearch::factory()->put_mapping( $this->get_index_name(), $mapping ); } From 46cdab051888477d60f24e7adf962a21a4713507 Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Tue, 9 Nov 2021 10:04:58 -0300 Subject: [PATCH 11/34] Update note about the stable branch --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71d3f7d515..a284849b32 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ * Check out the [ElasticPress Docs](http://10up.github.io/ElasticPress/) -**Please note:** master is the stable branch. +**Please note:** master is the stable branch, but that will be changing with the 4.0.0 release (read more on that below). ## Planned changes for 4.0.0 From e1a382700f2ae1f2a1f278f76e2c05df95ad4cc4 Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Tue, 9 Nov 2021 11:13:41 -0300 Subject: [PATCH 12/34] Fix CSR order for autosuggest --- assets/js/autosuggest.js | 2 +- dist/js/autosuggest-script.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/autosuggest.js b/assets/js/autosuggest.js index f0724f787f..78df4d2e82 100644 --- a/assets/js/autosuggest.js +++ b/assets/js/autosuggest.js @@ -363,7 +363,7 @@ function checkForOrderedPosts(hits, searchTerm) { }); } - return hits; + return filteredHits; } /** diff --git a/dist/js/autosuggest-script.min.js b/dist/js/autosuggest-script.min.js index f58d558793..54503a0f4b 100644 --- a/dist/js/autosuggest-script.min.js +++ b/dist/js/autosuggest-script.min.js @@ -1 +1 @@ -!function(){var t={9662:function(t,e,r){var n=r(614),o=r(6330);t.exports=function(t){if(n(t))return t;throw TypeError(o(t)+" is not a function")}},9483:function(t,e,r){var n=r(4411),o=r(6330);t.exports=function(t){if(n(t))return t;throw TypeError(o(t)+" is not a constructor")}},6077:function(t,e,r){var n=r(614);t.exports=function(t){if("object"===typeof t||n(t))return t;throw TypeError("Can't set "+String(t)+" as a prototype")}},1223:function(t,e,r){var n=r(5112),o=r(30),i=r(3070),a=n("unscopables"),c=Array.prototype;void 0==c[a]&&i.f(c,a,{configurable:!0,value:o(null)}),t.exports=function(t){c[a][t]=!0}},1530:function(t,e,r){"use strict";var n=r(8710).charAt;t.exports=function(t,e,r){return e+(r?n(t,e).length:1)}},5787:function(t){t.exports=function(t,e,r){if(t instanceof e)return t;throw TypeError("Incorrect "+(r?r+" ":"")+"invocation")}},9670:function(t,e,r){var n=r(111);t.exports=function(t){if(n(t))return t;throw TypeError(String(t)+" is not an object")}},8533:function(t,e,r){"use strict";var n=r(2092).forEach,o=r(9341)("forEach");t.exports=o?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},8457:function(t,e,r){"use strict";var n=r(9974),o=r(7908),i=r(3411),a=r(7659),c=r(4411),u=r(7466),s=r(6135),f=r(8554),l=r(1246);t.exports=function(t){var e=o(t),r=c(this),p=arguments.length,h=p>1?arguments[1]:void 0,d=void 0!==h;d&&(h=n(h,p>2?arguments[2]:void 0,2));var v,y,g,m,b,x,w=l(e),E=0;if(!w||this==Array&&a(w))for(v=u(e.length),y=r?new this(v):Array(v);v>E;E++)x=d?h(e[E],E):e[E],s(y,E,x);else for(b=(m=f(e,w)).next,y=r?new this:[];!(g=b.call(m)).done;E++)x=d?i(m,h,[g.value,E],!0):g.value,s(y,E,x);return y.length=E,y}},1318:function(t,e,r){var n=r(5656),o=r(7466),i=r(1400),a=function(t){return function(e,r,a){var c,u=n(e),s=o(u.length),f=i(a,s);if(t&&r!=r){for(;s>f;)if((c=u[f++])!=c)return!0}else for(;s>f;f++)if((t||f in u)&&u[f]===r)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},2092:function(t,e,r){var n=r(9974),o=r(8361),i=r(7908),a=r(7466),c=r(5417),u=[].push,s=function(t){var e=1==t,r=2==t,s=3==t,f=4==t,l=6==t,p=7==t,h=5==t||l;return function(d,v,y,g){for(var m,b,x=i(d),w=o(x),E=n(v,y,3),S=a(w.length),O=0,A=g||c,T=e?A(d,S):r||p?A(d,0):void 0;S>O;O++)if((h||O in w)&&(b=E(m=w[O],O,x),t))if(e)T[O]=b;else if(b)switch(t){case 3:return!0;case 5:return m;case 6:return O;case 2:u.call(T,m)}else switch(t){case 4:return!1;case 7:u.call(T,m)}return l?-1:s||f?f:T}};t.exports={forEach:s(0),map:s(1),filter:s(2),some:s(3),every:s(4),find:s(5),findIndex:s(6),filterReject:s(7)}},1194:function(t,e,r){var n=r(7293),o=r(5112),i=r(7392),a=o("species");t.exports=function(t){return i>=51||!n((function(){var e=[];return(e.constructor={})[a]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},9341:function(t,e,r){"use strict";var n=r(7293);t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},4362:function(t){var e=Math.floor,r=function(t,i){var a=t.length,c=e(a/2);return a<8?n(t,i):o(r(t.slice(0,c),i),r(t.slice(c),i),i)},n=function(t,e){for(var r,n,o=t.length,i=1;i0;)t[n]=t[--n];n!==i++&&(t[n]=r)}return t},o=function(t,e,r){for(var n=t.length,o=e.length,i=0,a=0,c=[];i=74)&&(n=a.match(/Chrome\/(\d+)/))&&(o=n[1]),t.exports=o&&+o},8008:function(t,e,r){var n=r(8113).match(/AppleWebKit\/(\d+)\./);t.exports=!!n&&+n[1]},748:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:function(t,e,r){var n=r(7854),o=r(1236).f,i=r(8880),a=r(1320),c=r(3505),u=r(9920),s=r(4705);t.exports=function(t,e){var r,f,l,p,h,d=t.target,v=t.global,y=t.stat;if(r=v?n:y?n[d]||c(d,{}):(n[d]||{}).prototype)for(f in e){if(p=e[f],l=t.noTargetGet?(h=o(r,f))&&h.value:r[f],!s(v?f:d+(y?".":"#")+f,t.forced)&&void 0!==l){if(typeof p===typeof l)continue;u(p,l)}(t.sham||l&&l.sham)&&i(p,"sham",!0),a(r,f,p,t)}}},7293:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},7007:function(t,e,r){"use strict";r(4916);var n=r(1320),o=r(2261),i=r(7293),a=r(5112),c=r(8880),u=a("species"),s=RegExp.prototype;t.exports=function(t,e,r,f){var l=a(t),p=!i((function(){var e={};return e[l]=function(){return 7},7!=""[t](e)})),h=p&&!i((function(){var e=!1,r=/a/;return"split"===t&&((r={}).constructor={},r.constructor[u]=function(){return r},r.flags="",r[l]=/./[l]),r.exec=function(){return e=!0,null},r[l](""),!e}));if(!p||!h||r){var d=/./[l],v=e(l,""[t],(function(t,e,r,n,i){var a=e.exec;return a===o||a===s.exec?p&&!i?{done:!0,value:d.call(e,r,n)}:{done:!0,value:t.call(r,e,n)}:{done:!1}}));n(String.prototype,t,v[0]),n(s,l,v[1])}f&&c(s[l],"sham",!0)}},9974:function(t,e,r){var n=r(9662);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}}},6530:function(t,e,r){var n=r(9781),o=r(6656),i=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,c=o(i,"name"),u=c&&"something"===function(){}.name,s=c&&(!n||n&&a(i,"name").configurable);t.exports={EXISTS:c,PROPER:u,CONFIGURABLE:s}},5005:function(t,e,r){var n=r(7854),o=r(614),i=function(t){return o(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?i(n[t]):n[t]&&n[t][e]}},1246:function(t,e,r){var n=r(648),o=r(8173),i=r(7497),a=r(5112)("iterator");t.exports=function(t){if(void 0!=t)return o(t,a)||o(t,"@@iterator")||i[n(t)]}},8554:function(t,e,r){var n=r(9662),o=r(9670),i=r(1246);t.exports=function(t,e){var r=arguments.length<2?i(t):e;if(n(r))return o(r.call(t));throw TypeError(String(t)+" is not iterable")}},8173:function(t,e,r){var n=r(9662);t.exports=function(t,e){var r=t[e];return null==r?void 0:n(r)}},647:function(t,e,r){var n=r(7908),o=Math.floor,i="".replace,a=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,c=/\$([$&'`]|\d{1,2})/g;t.exports=function(t,e,r,u,s,f){var l=r+t.length,p=u.length,h=c;return void 0!==s&&(s=n(s),h=a),i.call(f,h,(function(n,i){var a;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(l);case"<":a=s[i.slice(1,-1)];break;default:var c=+i;if(0===c)return n;if(c>p){var f=o(c/10);return 0===f?n:f<=p?void 0===u[f-1]?i.charAt(1):u[f-1]+i.charAt(1):n}a=u[c-1]}return void 0===a?"":a}))}},7854:function(t,e,r){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||function(){return this}()||Function("return this")()},6656:function(t,e,r){var n=r(7908),o={}.hasOwnProperty;t.exports=Object.hasOwn||function(t,e){return o.call(n(t),e)}},3501:function(t){t.exports={}},842:function(t,e,r){var n=r(7854);t.exports=function(t,e){var r=n.console;r&&r.error&&(1===arguments.length?r.error(t):r.error(t,e))}},490:function(t,e,r){var n=r(5005);t.exports=n("document","documentElement")},4664:function(t,e,r){var n=r(9781),o=r(7293),i=r(317);t.exports=!n&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},8361:function(t,e,r){var n=r(7293),o=r(4326),i="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},9587:function(t,e,r){var n=r(614),o=r(111),i=r(7674);t.exports=function(t,e,r){var a,c;return i&&n(a=e.constructor)&&a!==r&&o(c=a.prototype)&&c!==r.prototype&&i(t,c),t}},2788:function(t,e,r){var n=r(614),o=r(5465),i=Function.toString;n(o.inspectSource)||(o.inspectSource=function(t){return i.call(t)}),t.exports=o.inspectSource},9909:function(t,e,r){var n,o,i,a=r(8536),c=r(7854),u=r(111),s=r(8880),f=r(6656),l=r(5465),p=r(6200),h=r(3501),d="Object already initialized",v=c.WeakMap;if(a||l.state){var y=l.state||(l.state=new v),g=y.get,m=y.has,b=y.set;n=function(t,e){if(m.call(y,t))throw new TypeError(d);return e.facade=t,b.call(y,t,e),e},o=function(t){return g.call(y,t)||{}},i=function(t){return m.call(y,t)}}else{var x=p("state");h[x]=!0,n=function(t,e){if(f(t,x))throw new TypeError(d);return e.facade=t,s(t,x,e),e},o=function(t){return f(t,x)?t[x]:{}},i=function(t){return f(t,x)}}t.exports={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var r;if(!u(e)||(r=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}}},7659:function(t,e,r){var n=r(5112),o=r(7497),i=n("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||a[i]===t)}},3157:function(t,e,r){var n=r(4326);t.exports=Array.isArray||function(t){return"Array"==n(t)}},614:function(t){t.exports=function(t){return"function"===typeof t}},4411:function(t,e,r){var n=r(7293),o=r(614),i=r(648),a=r(5005),c=r(2788),u=[],s=a("Reflect","construct"),f=/^\s*(?:class|function)\b/,l=f.exec,p=!f.exec((function(){})),h=function(t){if(!o(t))return!1;try{return s(Object,u,t),!0}catch(t){return!1}};t.exports=!s||n((function(){var t;return h(h.call)||!h(Object)||!h((function(){t=!0}))||t}))?function(t){if(!o(t))return!1;switch(i(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return p||!!l.call(f,c(t))}:h},4705:function(t,e,r){var n=r(7293),o=r(614),i=/#|\.prototype\./,a=function(t,e){var r=u[c(t)];return r==f||r!=s&&(o(e)?n(e):!!e)},c=a.normalize=function(t){return String(t).replace(i,".").toLowerCase()},u=a.data={},s=a.NATIVE="N",f=a.POLYFILL="P";t.exports=a},111:function(t,e,r){var n=r(614);t.exports=function(t){return"object"===typeof t?null!==t:n(t)}},1913:function(t){t.exports=!1},7850:function(t,e,r){var n=r(111),o=r(4326),i=r(5112)("match");t.exports=function(t){var e;return n(t)&&(void 0!==(e=t[i])?!!e:"RegExp"==o(t))}},2190:function(t,e,r){var n=r(614),o=r(5005),i=r(3307);t.exports=i?function(t){return"symbol"==typeof t}:function(t){var e=o("Symbol");return n(e)&&Object(t)instanceof e}},408:function(t,e,r){var n=r(9670),o=r(7659),i=r(7466),a=r(9974),c=r(8554),u=r(1246),s=r(9212),f=function(t,e){this.stopped=t,this.result=e};t.exports=function(t,e,r){var l,p,h,d,v,y,g,m=r&&r.that,b=!(!r||!r.AS_ENTRIES),x=!(!r||!r.IS_ITERATOR),w=!(!r||!r.INTERRUPTED),E=a(e,m,1+b+w),S=function(t){return l&&s(l,"normal",t),new f(!0,t)},O=function(t){return b?(n(t),w?E(t[0],t[1],S):E(t[0],t[1])):w?E(t,S):E(t)};if(x)l=t;else{if(!(p=u(t)))throw TypeError(String(t)+" is not iterable");if(o(p)){for(h=0,d=i(t.length);d>h;h++)if((v=O(t[h]))&&v instanceof f)return v;return new f(!1)}l=c(t,p)}for(y=l.next;!(g=y.call(l)).done;){try{v=O(g.value)}catch(t){s(l,"throw",t)}if("object"==typeof v&&v&&v instanceof f)return v}return new f(!1)}},9212:function(t,e,r){var n=r(9670),o=r(8173);t.exports=function(t,e,r){var i,a;n(t);try{if(!(i=o(t,"return"))){if("throw"===e)throw r;return r}i=i.call(t)}catch(t){a=!0,i=t}if("throw"===e)throw r;if(a)throw i;return n(i),r}},3383:function(t,e,r){"use strict";var n,o,i,a=r(7293),c=r(614),u=r(30),s=r(9518),f=r(1320),l=r(5112),p=r(1913),h=l("iterator"),d=!1;[].keys&&("next"in(i=[].keys())?(o=s(s(i)))!==Object.prototype&&(n=o):d=!0),void 0==n||a((function(){var t={};return n[h].call(t)!==t}))?n={}:p&&(n=u(n)),c(n[h])||f(n,h,(function(){return this})),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:d}},7497:function(t){t.exports={}},5948:function(t,e,r){var n,o,i,a,c,u,s,f,l=r(7854),p=r(1236).f,h=r(261).set,d=r(6833),v=r(1528),y=r(1036),g=r(5268),m=l.MutationObserver||l.WebKitMutationObserver,b=l.document,x=l.process,w=l.Promise,E=p(l,"queueMicrotask"),S=E&&E.value;S||(n=function(){var t,e;for(g&&(t=x.domain)&&t.exit();o;){e=o.fn,o=o.next;try{e()}catch(t){throw o?a():i=void 0,t}}i=void 0,t&&t.enter()},d||g||y||!m||!b?!v&&w&&w.resolve?((s=w.resolve(void 0)).constructor=w,f=s.then,a=function(){f.call(s,n)}):a=g?function(){x.nextTick(n)}:function(){h.call(l,n)}:(c=!0,u=b.createTextNode(""),new m(n).observe(u,{characterData:!0}),a=function(){u.data=c=!c})),t.exports=S||function(t){var e={fn:t,next:void 0};i&&(i.next=e),o||(o=e,a()),i=e}},3366:function(t,e,r){var n=r(7854);t.exports=n.Promise},133:function(t,e,r){var n=r(7392),o=r(7293);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},8536:function(t,e,r){var n=r(7854),o=r(614),i=r(2788),a=n.WeakMap;t.exports=o(a)&&/native code/.test(i(a))},8523:function(t,e,r){"use strict";var n=r(9662),o=function(t){var e,r;this.promise=new t((function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n})),this.resolve=n(e),this.reject=n(r)};t.exports.f=function(t){return new o(t)}},3929:function(t,e,r){var n=r(7850);t.exports=function(t){if(n(t))throw TypeError("The method doesn't accept regular expressions");return t}},30:function(t,e,r){var n,o=r(9670),i=r(6048),a=r(748),c=r(3501),u=r(490),s=r(317),f=r(6200),l=f("IE_PROTO"),p=function(){},h=function(t){return"