-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to configure/restrict indexing by post status #59
Conversation
WalkthroughThe changes introduced in this diff primarily focus on enhancing the functionality of the plugin to restrict indexable post statuses for search operations. This is achieved by adding new properties, methods, and hooks in the Changes
Assessment against linked issues (Beta)
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (3)
- lib/adapters/class-adapter.php (3 hunks)
- lib/adapters/class-searchpress.php (3 hunks)
- lib/adapters/class-vip-enterprise-search.php (4 hunks)
Additional comments: 8
lib/adapters/class-searchpress.php (2)
52-70: The new method
apply_sync_post_statuses
is added to handle post statuses for indexing. It merges the restricted post statuses with the existing ones. Ensure that the restricted post statuses are correctly set before this method is called.481-493: The
hook
method is updated to include a new filter hooksp_config_sync_statuses
. Ensure that the filter is correctly applied in the context where it is used.lib/adapters/class-adapter.php (3)
77-85: The new property
restricted_post_statuses
is added to theAdapter
class. This property will hold an array of post statuses that are allowed to be indexed. This is a good addition for controlling which post statuses should be indexed.393-403: The getter method
get_restricted_post_statuses
is added for the new propertyrestricted_post_statuses
. This method will return the array of restricted post statuses. This is a good practice as it encapsulates the property and provides controlled access to it.504-514: The setter method
restrict_post_statuses
is added for the new propertyrestricted_post_statuses
. This method will set the array of restricted post statuses. This is a good practice as it encapsulates the property and provides controlled access to it.lib/adapters/class-vip-enterprise-search.php (3)
80-101: The new method
filter__ep_indexable_post_statuses
is introduced to filter the list of post statuses to be indexed in ElasticPress. It checks if there are any restricted post statuses and if there are, it merges them with the existing post statuses. The use ofarray_unique
ensures there are no duplicate statuses. The logic seems correct.567-573: The new method
filter__ep_indexable_post_statuses
is registered as a filter forep_indexable_post_status
. This ensures that the method is called whenever theep_indexable_post_status
filter is applied.589-595: The new method
filter__ep_indexable_post_statuses
is unregistered from theep_indexable_post_status
filter. This ensures that the method is no longer called when theep_indexable_post_status
filter is applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- lib/adapters/class-searchpress.php (3 hunks)
Additional comments: 3
lib/adapters/class-searchpress.php (3)
53-70: The new method
apply_sync_post_statuses
is added to handle post statuses for indexing. It merges the restricted post statuses with the existing ones. Ensure that the restricted post statuses are correctly set before this method is called.482-493: The
hook
method is updated to include a new filter hooksp_config_sync_statuses
and its corresponding callbackapply_sync_post_statuses
. Ensure that this hook is correctly triggered in the expected scenarios.499-511: The
unhook
method is updated to remove the new filter hooksp_config_sync_statuses
and its corresponding callbackapply_sync_post_statuses
. Ensure that this unhook operation is correctly triggered when needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐙
I opted to use the grammatically correct plural version:
statuses
. Even though ElasticPress uses the singular version.The Wiki must be updated after this is merged.
fixes #58
Summary by CodeRabbit