Skip to content
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 filter to remove search weighting engine #2522

Merged
merged 8 commits into from
Jan 7, 2022
6 changes: 3 additions & 3 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
path: 'wp-content/plugins/elasticpress'

Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
wp cli-command-docs elasticpress --custom-order=index,activate-feature,deactivate-feature,list-features,get-algorithm-version,set-algorithm-version --remove=delete_transient_on_int,custom_get_transient --custom-intro='The following WP-CLI commands are supported by ElasticPress:' > wp-content/plugins/elasticpress/docs/wp-cli.md

- name: Use Node.js 10
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: '10.x'

Expand All @@ -65,7 +65,7 @@ jobs:
CI: true

- name: Deploy to GH Pages
uses: maxheld83/ghpages@v0.2.1
uses: maxheld83/ghpages@v0.3.0
env:
BUILD_DIR: 'docs-built/'
GH_PAT: ${{ secrets.GH_PAT }}
2 changes: 1 addition & 1 deletion .github/workflows/push-asset-readme-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Push to master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- name: WordPress.org plugin asset/readme update
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
Expand Down
12 changes: 12 additions & 0 deletions includes/classes/Feature/Search/Weighting.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ class Weighting {
* Sets up the weighting module
*/
public function setup() {
/**
* Filter to disable loading of Search weighting engine.
*
* @hook ep_disable_search_weighting
* @since 4.0
* @param bool Whether to disable search weighting engine. Defaults to false.
* @return bool Whether to disable search weighting engine.
*/
if ( apply_filters( 'ep_disable_search_weighting', false ) ) {
return;
}

add_action( 'admin_menu', [ $this, 'add_weighting_submenu_page' ], 15 );
add_action( 'admin_post_ep-weighting', [ $this, 'handle_save' ] );
add_filter( 'ep_formatted_args', [ $this, 'do_weighting' ], 20, 2 ); // After date decay, etc are injected
Expand Down