-
Notifications
You must be signed in to change notification settings - Fork 313
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
Facet by Meta #2954
Facet by Meta #2954
Conversation
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.
Just some minor comments. One thing i'm wondering though - How will things work when people have multiple facet blocks of the same type. I did not see any variation in filters based on the block id or the like. Have you tested this?
public function render_block_preview( $request ) { | ||
global $wp_query; | ||
|
||
add_filter( 'ep_is_facetable', '__return_true' ); |
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.
would it make sense to provide more context in the filter to be able to make a decision?
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.
|
||
$meta_values = get_transient( self::TRANSIENT_PREFIX . $meta_key ); | ||
if ( ! $meta_values ) { | ||
$meta_values = \ElasticPress\Indexables::factory()->get( 'post' )->get_all_distinct_values( "meta.{$meta_key}.raw" ); |
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.
wondering if we need to truncate those values. there could be huge data in meta fields eventually. maybe truncate out only first 100 chars or so?
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.
As I can see some usefulness in bringing more data in other scenarios, in 2626fb4 I've added the number as a parameter.
With the change made in 7c1b813, this is the code needed to make Facet by Meta blocks available:
|
Description of the Change
This PR is the following step to #2919, implementing a new type for meta fields.
It still needs tests.
How to test the Change
Changelog Entry
Credits
Props @felipeelia