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

Implementing "OR filter relationships" in DateQuery.php #4076

Open
eartahhj opened this issue Feb 6, 2025 · 0 comments
Open

Implementing "OR filter relationships" in DateQuery.php #4076

eartahhj opened this issue Feb 6, 2025 · 0 comments
Labels
medium (4 - 16 hours)
Milestone

Comments

@eartahhj
Copy link

eartahhj commented Feb 6, 2025

Hello, I was trying to understand why my date_query was not working with ElasticPress. When disabling the EP plugin the query works, when activating it, the query does not work correctly.

After debugging and researching, I came up to this file: includes/classes/Indexable/Post/DateQuery.php

Which, as of today, contains this comment:

// @todo implement OR filter relationships.

Is there a plan to implement this soon?

Here is an example of my date_query, obtained in the debugging addon:

'date_query' => 
  array (
    0 => 
    array (
      'year' => '2019',
    ),
    1 => 
    array (
      'year' => '2016',
    ),
    2 => 
    array (
      'year' => '2015',
    ),
    'relation' => 'OR',
  ),

Another example:

  'date_query' => 
  array (
    0 => 
    array (
      'after' => '2019-01-01 00:00:00',
      'before' => '2019-12-31 23:59:59',
    ),
    1 => 
    array (
      'after' => '2016-01-01 00:00:00',
      'before' => '2016-12-31 23:59:59',
    ),
    2 => 
    array (
      'after' => '2015-01-01 00:00:00',
      'before' => '2015-12-31 23:59:59',
    ),
    'relation' => 'OR',
    'inclusive' => true,
  ),

When using the OR relation and analyzing the resulting CURL request with the debugging tool, I can see that the "post_filter" parameter has nothing about years or date ranges, because that relationship has not been implemented yet.

I don't know EP plugin code much so I am not sure I could help with this. But maybe you have already planned to release this soon.

Thank you and kind regards

@felipeelia felipeelia added this to the 5.2.0 milestone Feb 6, 2025
@felipeelia felipeelia added the medium (4 - 16 hours) label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium (4 - 16 hours)
Projects
None yet
Development

No branches or pull requests

2 participants