Implement "OR filter relationships" in DateQuery - #4165
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements support for "OR filter relationships" within the DateQuery functionality, enabling date queries to combine conditions using a logical OR. Key changes include:
- Adding test cases in TestPost.php to validate various OR-based date query scenarios.
- Extending the parse_date method in Post.php to account for an "or" key.
- Implementing the OR relation clause in DateQuery.php that builds appropriate Elasticsearch filters.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/php/indexables/TestPost.php | New test cases validating OR relation behavior in date queries. |
| includes/classes/Indexable/Post/Post.php | Updated parse_date to return value for an "or" filter, enabling OR logic. |
| includes/classes/Indexable/Post/DateQuery.php | New OR relation branch added to build Elasticsearch "should" clauses. |
Comments suppressed due to low confidence (1)
includes/classes/Indexable/Post/DateQuery.php:137
- [nitpick] Consider adding a comment to explain the logic behind constructing the 'should' clauses for the OR relation. This documentation would clarify the intent and structure for future maintainers.
],
felipeelia
requested changes
Jun 24, 2025
felipeelia
left a comment
Member
There was a problem hiding this comment.
Can we add @since tags to the tests please, @burhandodhy ?
Member
|
@burhandodhy can you please fix this git conflict so we can merge this one? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
This PR adds support for the relationship
ORin Date Query.Closes #4076
How to test the Change
Changelog Entry
Credits
Props @burhandodhy @eartahhj
Checklist: