Okay, @bolus150 , I finally got what you’re trying to say!
Please read my message till the end before trying anything.
First, big thank you for this question, because you detected a bug which shown posts even if their relevance was 0. I made an update in WPFTS which fixed this. Thus, if you set up cluster weight for post_content = 0, it will not search in this index cluster at all. Cool.
Another thing is your ‘product_content’ meta tag. As I understand, you tried to avoid WP from searching for posts by Gutenberg meta tags and comments. For example, if you put an image to the post, this post will be searchable by the word “image” because there is a Gutenberg comment like <– g:image … –> which is recognized by WP integrated search as normal content. Which is completely wrong.
That’s why I guess you made a new meta tag “product_content”. You are filtering the post_content (by strip_tags or so) in your custom code and save to this meta tag. Let me know if I’m wrong.
With WPFTS you don’t need for this additional meta tag. Because you can clean up post_content in a stage of indexing. Just use the code:
add_filter('wpfts_index_post', function($index, $post)
{
$index['post_content'] = strip_tags($index['post_content']);
return $index;
}, 3, 2);
You can use your own custom function instead of strip_tags().
Realizing that many WP users who decided to use Gutenberg (almost all I guess) may face the same problem, I added this piece of code and a respective option to the settings.
This is how it looks: https://e-wm.org/i/E20190802-074346-001.png
And now you don’t need to add any code at all. And you also may remove the product_content meta.
Please update the WPFTS plugin now and let me know if it helps somehow.
Thanks!
-
This reply was modified 5 years, 3 months ago by Epsiloncool.