-
Notifications
You must be signed in to change notification settings - Fork 29
Support order by post__in, post_parent__in and post_name__in #51
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
base: main
Are you sure you want to change the base?
Conversation
class-es-wp-query-wrapper.php
Outdated
| usort( $posts, function( $a, $b ) use ( $order, $key, $use_source ) { | ||
| // Add support for using the Elasticsearch _source field. | ||
| if ( $use_source ) { | ||
| // Elasticsearch stores the `ID` field as `post_id`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily; VIP's ES mapping != SearchPress'. All fields need to be "translated" to the adapter's map, e.g. $this->es_map( 'post_id' ) to get the right field. Same goes for the switch above where $key gets set.
| return; | ||
| } | ||
|
|
||
| $this->posts = $this->post_query_sort_handler( $this->posts, $q ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with the rest of the switch, I would add a return; after this statement.
class-es-wp-query-wrapper.php
Outdated
| } | ||
| } | ||
|
|
||
| if ( ! isset( $order[ $a->$key ] ) || ! isset( $order[ $b->$key ] ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you also need to check if $a->$key and $b->$key exist
|
@mboynes pushed up a fix that will translate the |
|
@mboynes Just an FYI that I will be taking this PR over from Sean. If you have any more feedback please let me know :) |
No description provided.