Skip to content

Improve indexed/searched post types and statuses#58

Merged
mboynes merged 11 commits intomasterfrom
feature/index-everything
Dec 8, 2016
Merged

Improve indexed/searched post types and statuses#58
mboynes merged 11 commits intomasterfrom
feature/index-everything

Conversation

@mboynes
Copy link
Copy Markdown
Contributor

@mboynes mboynes commented Oct 20, 2016

Adds much more flexibility to what gets indexed and searched.

Resolves #16
Resolves #31

Adds much more flexibility to what gets indexed and searched.
@mboynes mboynes added enhancement New feature or request needs-unit-tests labels Oct 20, 2016
* 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
@mboynes
Copy link
Copy Markdown
Contributor Author

mboynes commented Oct 25, 2016

Consider resolving #47 before merging this, since this alters the mapping.

Copy link
Copy Markdown

@joshkadis joshkadis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 suggestion otherwise ⛱


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' );
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe have timeout duration inside a config or apply_filters()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() ),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mboynes mboynes merged commit 271be6c into master Dec 8, 2016
@renatonascalves renatonascalves deleted the feature/index-everything branch February 22, 2019 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Indexing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants