-
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
'Did you mean' in FSE theme #3993
Comments
Can you please share your ElasticPress Status Report, @Ecknauer? I'm mostly interested in knowing your ES version. Also, did you try only |
Hi, I will update my op as I figured out how to get suggestions for default 'post_content' and also 'post_excerpt', 'post_title'. So other will have easier time figuring out on how to implement 'Did you mean' feature. The only thing that I can't still achieve is to add post meta filed (acf) to the mapping and being able to get suggestion options on it. For instance where 'ep_acf_test' is a post meta field: // Shingle token filter.
$mapping['settings']['analysis']['filter']['shingle_filter'] = [
'type' => 'shingle',
'min_shingle_size' => 2,
'max_shingle_size' => 3,
];
// Custom analyzer.
$mapping['settings']['analysis']['analyzer']['trigram'] = [
'type' => 'custom',
'tokenizer' => 'standard',
'filter' => [
'lowercase',
'shingle_filter',
],
];
// Add meta field to the mapping
$mapping['mappings']['properties']['meta']['properties']['ep_acf_test'] = [
'type' => 'text',
'fields' => [
'shingle' => [
'type' => 'text',
'analyzer' => 'trigram',
],
'raw' => [
'type' => 'keyword',
'ignore_above' => 10922,
],
],
]; And then I use this filter to add additional suggester on top default 'ep_suggestion': add_filter('ep_post_formatted_args', function ($formatted_args, $args, $wp_query) {
$search_analyzer_ = [
'phrase' => [
'field' => 'meta.ep_acf_test.shingle',
'max_errors' => 2,
'direct_generator' => [
[
'field' => 'meta.ep_acf_test.shingle',
],
],
],
];
$formatted_args['suggest']['ep_suggestion_meta'] = $search_analyzer;
return $formatted_args;
}, 20, 3); Status Report:
|
It has been 3 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 3 days, but if you have more information to add then please comment and the issue will stay open. |
Still waiting for a reply. Don't mark the issue as closed |
Describe your question
Hi,
I have tried to place
<?php do_action( 'ep_suggestions' ); ?>
inside of Classic theme and FSE theme but to no avail.
From reading the article on ElasticPress Docs I couldn't understand if I have to place this code inside of search form template (e.g.
<form></form>
) or search results template?I have products with the title, for instance, Harry Potter. I have tried to look up items by the string: "happy rotter" to cause no search results. However, upon expecting the query with WP Query + ElasticPress Debug Add-on it doesn't return any suggestions results.
Code of Conduct
The text was updated successfully, but these errors were encountered: