@@ -9736,6 +9736,75 @@ public function test_mapping_ep_stop_filter() {
97369736 $ this ->assertSame ( '_arabic_ ' , $ index_settings ['index.analysis.filter.ep_stop.stopwords ' ] );
97379737 }
97389738
9739+ /**
9740+ * Test the `ep_asciifolding` filter
9741+ *
9742+ * @since 5.3.3
9743+ * @group post
9744+ */
9745+ public function test_mapping_ep_asciifolding_filter () {
9746+ $ indexable = ElasticPress \Indexables::factory ()->get ( 'post ' );
9747+ $ index_name = $ indexable ->get_index_name ();
9748+ $ settings = ElasticPress \Elasticsearch::factory ()->get_index_settings ( $ index_name );
9749+ $ index_settings = $ settings [ $ index_name ]['settings ' ];
9750+
9751+ $ es_version = ElasticPress \Elasticsearch::factory ()->get_elasticsearch_version ();
9752+ if ( version_compare ( $ es_version , '7.0 ' , '< ' ) ) {
9753+ // ES5 format: flattened keys like 'index.analysis.analyzer.default.filter.0', '.1', etc.
9754+ $ default_filter_keys = array_filter (
9755+ $ index_settings ,
9756+ fn ( $ value , $ key ) => str_contains ( $ key , 'index.analysis.analyzer.default.filter. ' ),
9757+ ARRAY_FILTER_USE_BOTH
9758+ );
9759+ $ this ->assertContains ( 'ep_asciifolding ' , $ default_filter_keys );
9760+
9761+ $ default_search_filter_keys = array_filter (
9762+ $ index_settings ,
9763+ fn ( $ value , $ key ) => str_contains ( $ key , 'index.analysis.analyzer.default_search.filter. ' ),
9764+ ARRAY_FILTER_USE_BOTH
9765+ );
9766+ $ this ->assertContains ( 'ep_asciifolding ' , $ default_search_filter_keys );
9767+
9768+ } else {
9769+ $ this ->assertContains ( 'ep_asciifolding ' , $ index_settings ['index.analysis.analyzer.default.filter ' ] );
9770+ $ this ->assertContains ( 'ep_asciifolding ' , $ index_settings ['index.analysis.analyzer.default_search.filter ' ] );
9771+ }
9772+ }
9773+
9774+ /**
9775+ * Test the post returns correct with accented characters
9776+ *
9777+ * @since 5.3.3
9778+ * @group post
9779+ */
9780+ public function test_search_handles_accented_characters_correctly () {
9781+ $ post_id_1 = $ this ->ep_factory ->post ->create ( [ 'post_title ' => 'Coöperàtîôn ' ] );
9782+ $ post_id_2 = $ this ->ep_factory ->post ->create ( [ 'post_title ' => 'Fiancéé ' ] );
9783+
9784+ // disable fuzziness
9785+ add_filter ( 'ep_fuzziness ' , '__return_zero ' );
9786+
9787+ ElasticPress \Elasticsearch::factory ()->refresh_indices ();
9788+
9789+ $ query = new \WP_Query (
9790+ [
9791+ 's ' => 'coöperàtîôn ' ,
9792+ ]
9793+ );
9794+ $ this ->assertTrue ( $ query ->elasticsearch_success );
9795+ $ this ->assertEquals ( 1 , $ query ->found_posts );
9796+ $ this ->assertEquals ( $ post_id_1 , $ query ->posts [0 ]->ID );
9797+
9798+ $ query = new \WP_Query (
9799+ [
9800+ 's ' => 'fiancee ' ,
9801+ ]
9802+ );
9803+ $ this ->assertTrue ( $ query ->elasticsearch_success );
9804+ $ this ->assertEquals ( 1 , $ query ->found_posts );
9805+ $ this ->assertEquals ( $ post_id_2 , $ query ->posts [0 ]->ID );
9806+ }
9807+
97399808 /**
97409809 * Test if aggregations are set
97419810 *
0 commit comments