alleyinteractive / archiveless

WordPress plugin to hide posts from archives (lists)
GNU General Public License v2.0
7 stars 4 forks source link

Handling `archiveless` posts in Elasticsearch queries #62

Closed renatonascalves closed 8 months ago

renatonascalves commented 8 months ago

Description

This is a similar problem with #61. The only difference is that Elasticsearch performs the request.

I noticed that by toggling the "Hide from Archives" button, the post is completely removed from Elasticsearch. Not only hidden but literally gone.

That means one can index post types with support for the plugin but need to search (with Elasticsearch) it is impossible.

In other Alley projects (see https://github.com/alleyinteractive/byline-manager/issues/120), that's been talks about handling it in the culprit plugin rather than leaving to consumers to resolve.


I was able to track the source of the issue to this line. That's then used here. That's being affected by these loc:

https://github.com/alleyinteractive/archiveless/blob/bd866031d04078a1553ca0fada4e0bf221a05dd3/inc/class-archiveless.php#L189-L223

Use Case

This bug recently affected a client site. The client has a post type where they can't search the parent post in the Page Attributes slotfill because the archived parent doesn't appear in the results list (since it is removed from Elasticsearch).

The client uses VIP Search. But we should consider other plugins, like SearchPress, in the solution.