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

Fix post tag duplication in ES query #2341

Merged
merged 18 commits into from
Sep 24, 2021
Merged

Conversation

oscarssanchez
Copy link
Contributor

Description of the Change

This PR aims to fix three things. First, there's a duplication of terms.post_tag.slug similar to the problem that was happening in #2242 when you are making with similar args:

$args = [
	'ep_integrate' => true,
	'tag' => array( 'slug1, slug2' ),
];

This is fixed here: https://github.com/10up/ElasticPress/compare/fix/post-tag-duplication?expand=1#diff-7004c1b9f26ece8d68d4d3b7b822331a1f1e0cdf34a5eda1aa146d930d21ad08R1007 adding post_tag and category as these are WP Core default taxonomies, and I have added the filter 'ep_post_tax_excluded_wp_query_root_check' in case this is needed to be extended by a developer.

Second, doing a query for more than one term in an array form does not work, as it will format the tag arg like a comma separated string.

Third, searching for multiple tags with comma separated tags does not work at all. This is allowed by core: https://developer.wordpress.org/reference/classes/wp_query/#tag-parameters

It looks like core will translate both the array and comma separated strings as comma separated, which is different than how it formats a tax query, therefore that part remains unaffected

Alternate Designs

Benefits

Expand WP_Query

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

@oscarssanchez oscarssanchez changed the title Fix/post tag duplication WIP: Fix/post tag duplication Sep 7, 2021
@oscarssanchez oscarssanchez changed the title WIP: Fix/post tag duplication Fix/post tag duplication Sep 14, 2021
@oscarssanchez oscarssanchez changed the title Fix/post tag duplication Fix post tag duplication in ES query Sep 14, 2021
Rahmon
Rahmon previously approved these changes Sep 21, 2021
@Rahmon Rahmon assigned oscarssanchez and unassigned Rahmon Sep 21, 2021
@oscarssanchez oscarssanchez merged commit fd70732 into develop Sep 24, 2021
@oscarssanchez oscarssanchez deleted the fix/post-tag-duplication branch September 24, 2021 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants