-
Notifications
You must be signed in to change notification settings - Fork 29
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
Use author ID instead of nicename for author archive queries #46
Conversation
Great catch and thanks for the PR! I would rather fix this in the VIP adapter instead of the plugin's core class. If the adapter has |
@mboynes From what I understand, VIP doesn't have |
@mboynes Or did you mean adding this logic to the |
I meant adding it to the |
Ya, we don't have that field. See: https://developer.wordpress.com/docs/elasticsearch/post-doc-schema/ |
@mboynes I just added the user ID lookup to the VIP adapter. |
if ( function_exists( 'es_api_search_index' ) ) { | ||
return es_api_search_index( $es_args, 'es-wp-query' ); | ||
if ( ! function_exists( 'es_api_search_index' ) ) { | ||
return new WP_Error( 'vip-es-api-missing', 'Missing es_api_search_index method' ); |
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.
@mboynes Previously it was failing silently. I noticed that set_posts()
checks for is_wp_error()
so this shouldn't introduce any regression.
* @see https://developer.wordpress.com/docs/elasticsearch/post-doc-schema/ | ||
*/ | ||
function vip_es_query_filter( $filter ) { | ||
foreach ( $filter as $filter_no => $filter_rule ) { |
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.
@mboynes I really don't like the way this looks so please let me know if you think there is a better way to approach this.
I was considering adding a new filter to the output of es_map()
but I was worried of how many times it will be called during a single query and the potential performance issues because of that.
Secondly, I don't know what happens when we combine this with author__in
and author__not_in
filters. @gibrown Do you have any feedback on that?
Replaced by #47. |
Ready for code review.
WordPress core maps
author_name
to the user ID for the author archive queries.We are having an issue on VIP (ZD ticket 60751) where author archives
http://example.com/author/username
which rewrite tohttp://example.com/?author_name=username
are returning a 404. It appears that VIP doesn't have a field forpost_author.user_nicename
in the ES index.Maybe also related to #43.