Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/default analyzer filter upstream #2282

Merged

Conversation

pschoffer
Copy link
Contributor

@pschoffer pschoffer commented Jul 29, 2021

Description of the Change

In order to adjust default analyzer filters, we introduced a WP filter ep_default_analyzer_filters.

For example to enable ascii folding on most fields (e.g. post_title, post_content):

	add_filter( 'ep_default_analyzer_filters', function ( $filters ) {
			return  array( 'ewp_word_delimiter', 'lowercase', 'stop', 'asciifolding', 'ewp_snowball' );
}
		);

Steps to Test

  1. Create a post with tittle "Hamburger"
  2. Create a post with tittle "Hàmburger"
  3. Add the filter from the example above
  4. Reindex all the posts using new mappings - vip dev-env exec -- wp vip-search index --setup
  5. Search for both Hamburger and Hàmburger should return BOTH posts.

Alternate Designs

Benefits

Possible Drawbacks

Verification Process

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Changelog Entry

@felipeelia
Copy link
Member

Thank you very much for this @pschoffer! Do you mind adding that filter to the other mapping versions as well? Also, can you please add a @since 3.6.2 to their docs? Thanks!

@pschoffer
Copy link
Contributor Author

Sure, Done @felipeelia .

@felipeelia felipeelia added this to the 3.6.2 milestone Aug 19, 2021
@felipeelia felipeelia merged commit f9fe895 into 10up:develop Aug 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants