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

Update documentation for is solr query #643

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog ##

### 2.6.0-dev ###
* Adds `is_solr_query` filter [[#588](https://github.com/pantheon-systems/solr-power/pull/588)] (props [@sboisvert](https://wordpress.org/support/users/sboisvert/))

### 2.5.3 (April 24, 2024) ###
* Fixes a very old bug that would cause tax queries to be built incorrectly. [[#622](https://github.com/pantheon-systems/solr-power/pull/622)] (props [@offshorealert](https://wordpress.org/support/users/offshorealert/))

Expand Down
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
**Tags:** search
**Requires at least:** 4.6
**Requires PHP:** 7.1
**Tested up to:** 6.5.2
**Stable tag:** 2.5.4-dev
**Tested up to:** 6.7.1
**Stable tag:** 2.6.0-dev
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -194,6 +194,27 @@ Add the following to your `functions.php` file.
}
add_filter( 'solr_dismax_query', 'my_solr_dismax_query' );

### `is_solr_query` Filter

The `is_solr_query` filter controls whether Solr should be used for a specific query.

Parameters:

* $enabled (bool): Indicates whether Solr should be used for the query. Defaults to true if the query is a search or if solr_integrate is set in the query.
* $query (WP_Query): The current WordPress query object.

Return:

* bool: true to enable Solr for the query, false to disable it.

```php
add_filter( 'is_solr_query', function( $enabled, $query ) {
if ( $query->is_category( 'news' ) ) {
return false;
}
return $enabled;
}, 10, 2 );
```

## Common issues ##

Expand Down
18 changes: 11 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "solr-power",
"version": "2.5.4-dev",
"version": "2.6.0-dev",
"repository": {
"type": "git",
"url": "https://github.com/pantheon-systems/solr-power.git"
Expand Down
27 changes: 25 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: getpantheon, Outlandish Josh, 10up, collinsinternet, andrew.taylor
Tags: search
Requires at least: 4.6
Requires PHP: 7.1
Tested up to: 6.5.2
Stable tag: 2.5.4-dev
Tested up to: 6.7.1
Stable tag: 2.6.0-dev
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -205,6 +205,25 @@ Add the following to your `functions.php` file.
}
add_filter( 'solr_dismax_query', 'my_solr_dismax_query' );

= ```is_solr_query``` Filter =

The `is_solr_query` filter controls whether Solr should be used for a specific query.

Parameters:

* $enabled (bool): Indicates whether Solr should be used for the query. Defaults to true if the query is a search or if solr_integrate is set in the query.
* $query (WP_Query): The current WordPress query object.

Return:

* bool: true to enable Solr for the query, false to disable it.

add_filter( 'is_solr_query', function( $enabled, $query ) {
if ( $query->is_category( 'news' ) ) {
return false;
}
return $enabled;
}, 10, 2 );

= Common issues =

Expand Down Expand Up @@ -235,6 +254,10 @@ Please report security bugs found in the source code of the Solr Power plugin th

== Changelog ==


= 2.6.0-dev =
* Adds `is_solr_query` filter [[#588](https://github.com/pantheon-systems/solr-power/pull/588)] (props [@sboisvert](https://wordpress.org/support/users/sboisvert/))

= 2.5.3 (April 24, 2024) =
* Fixes a very old bug that would cause tax queries to be built incorrectly. [[#622](https://github.com/pantheon-systems/solr-power/pull/622)] (props [@offshorealert](https://wordpress.org/support/users/offshorealert/))

Expand Down
4 changes: 2 additions & 2 deletions solr-power.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
/**
* Plugin Name: Solr Power
* Description: Allows WordPress sites to index and search content with ApacheSolr.
* Version: 2.5.4-dev
* Version: 2.6.0-dev
* Author: Pantheon
* Author URI: http://pantheon.io
* Text Domain: solr-for-wordpress-on-pantheon
*
* @package Solr_Power
**/

define( 'SOLR_POWER_VERSION', '2.5.4-dev' );
define( 'SOLR_POWER_VERSION', '2.6.0-dev' );

/**
* Copyright (c) 2011-2022 Pantheon, Matt Weber, Solr Power contributors
Expand Down
Loading