Skip to content

Commit

Permalink
Update documentation for is solr query
Browse files Browse the repository at this point in the history
  • Loading branch information
pwtyler committed Dec 4, 2024
1 parent f9add2f commit 04b8422
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 7 deletions.
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
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
**Requires at least:** 4.6
**Requires PHP:** 7.1
**Tested up to:** 6.5.2
**Stable tag:** 2.5.4-dev
**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
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
25 changes: 24 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: search
Requires at least: 4.6
Requires PHP: 7.1
Tested up to: 6.5.2
Stable tag: 2.5.4-dev
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

0 comments on commit 04b8422

Please sign in to comment.