10up / ElasticPress

A fast and flexible search and query engine for WordPress.
https://elasticpress.io
GNU General Public License v2.0
1.24k stars 312 forks source link

Hook to run post_content filter before prepare_document() #3892

Closed Slamik closed 4 months ago

Slamik commented 5 months ago

Describe your question

I would like to fire my post_content filter before it is prepared for index. Is there any hook for this?

In other words, I'm trying to store filtered post_content to the ElasticSearch index.

Thank you in advance!

Code of Conduct

felipeelia commented 4 months ago

Hi @Slamik, I'm not sure I understood what you need, sorry. ElasticPress indexes a field called "post_content_filtered" already. If you want to search for that field, you can see how in this article. If that is not what you want, do you mind explaining a bit further your use case? Thanks

Slamik commented 4 months ago

I'm not sure I understood what you need, sorry.

Hi @felipeelia My post_content trigger is firing only from certain post templates and does not filter content globally. I would like to have an entry point to fire my filter before the content is added to the index."

For example, before or after: (https://github.com/10up/ElasticPress/blob/2dadd9241a75354454ee28241a905b0429983ee7/includes/classes/Indexable/Post/Post.php#L490)

apply_filters( 'ep_before_post_content_filtered_index', $post );

github-actions[bot] commented 4 months ago

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.

Slamik commented 4 months ago

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.

already https://github.com/10up/ElasticPress/issues/3892#issuecomment-2052104280

felipeelia commented 4 months ago

Hi @Slamik. any reason why you can't use ep_post_sync_args_post_prepare_meta (by the end of the prepare_document() method) to change what you need? I'm not opposed to adding a new filter, I just want to be sure that is really needed.

github-actions[bot] commented 4 months ago

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.

github-actions[bot] commented 4 months ago

This issue has been automatically closed because there has been no response to our request for more information in the past 3 days. With only the information that is currently available, we are unable to take further action on this ticket. Please reach out if you have found or find the answer we need so that we can investigate further. When the information is ready, you can re-open this ticket to share it with us.