Improve indexed/searched post types and statuses#58
Conversation
Adds much more flexibility to what gets indexed and searched.
* Fix failing unit tests from indexing all post types and statuses * Fix bugs that the unit tests caught * Add more unit tests for post statuses
|
Consider resolving #47 before merging this, since this alters the mapping. |
This resolves issues where some tests' env changes were bleeding into other tests
... to avoid race conditions
lib/class-sp-api.php
Outdated
|
|
||
| public function cluster_health() { | ||
| $health_uri = apply_filters( 'sp_cluster_health_uri', '/_cluster/health/' . $this->index ); | ||
| $health_uri = apply_filters( 'sp_cluster_health_uri', '/_cluster/health/' . $this->index . '?wait_for_status=yellow&timeout=0.2s' ); |
There was a problem hiding this comment.
maybe have timeout duration inside a config or apply_filters()?
There was a problem hiding this comment.
I thought about doing that, but it ultimately is being filtered. If someone wanted to change it, they could do so through this filter (sp_cluster_health_uri). I'll add a docblock highlighting that.
| $this->posts = get_posts( array( | ||
| 'post_type' => 'any', | ||
| 'post_status' => 'any', | ||
| 'post_type' => array_values( get_post_types() ), |
There was a problem hiding this comment.
i would flip these two back to 'any', if we're doing a query by $id, there should be nothing else to impede that in some edge case where there is an id we want that for some reason had a post type or status that isn't returned by those functions
There was a problem hiding this comment.
Believe it or not, that's the reason for the change -- you just have it backwards. get_post_types() is more inclusive than 'any'. 'any' is a bit of a misnomer, as it excludes post types with 'exclude_from_search' => true.
Adds much more flexibility to what gets indexed and searched.
Resolves #16
Resolves #31