Skip to content

Commit fe87240

Browse files
authored
Release 2.6.1 (#362)
* avoid database settings lookups on each iteration, add in some except… (#357) * avoid database settings lookups on each iteration, add in some exception catching just in case. * fill in a missed phpdoc * add filter to our delete_item methods second parameter. Default to fa… (#361) * add filter to our delete_item methods second parameter. Default to false to return async behavior. * move the apply filters to an assigned variable and pass the variable to the method * pesky semicolons * changelogs and version bumps
1 parent fcab8a4 commit fe87240

8 files changed

+79
-11
lines changed

CHANGELOG.md

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
## 2.6.1
2+
3+
* Fixed: Performance issues related to delete operations.
4+
* Fixed: Performance issues around WP All Import.
5+
6+
## 2.6.0
7+
8+
* Added: Support for syncing imported items when "fast mode" from WP All Import enabled.
9+
* Added: Support for updating child posts if parent post's slug has been updated.
10+
* Added: Support for updating posts when an associated term has been updatd.
11+
* Added: Wait for delete operations to complete before moving to updates.
12+
* Updated: Algolia Search library to 4.18.x
13+
* Updated: InstantSearch library to 4.56.x
14+
15+
## 2.5.4
16+
17+
* Updated: Ensure reindexing completes when using the from_batch flag with CLI.
18+
* Updated: Assigned Algolia_Admin instance to a property for access elsewhere.
19+
120
## 2.5.3
221

322
* Updated: Autocomplete template file with user link fix when cmd/ctrl clicking.

README.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Contributors: WebDevStudios, williamsba1, tw2113, mrasharirfan, scottbasgaard, gregrickaby, richaber
33
Tags: search, algolia, autocomplete, instantsearch, relevance search, faceted search, find-as-you-type search, ecommerce, seo, woocommerce, advanced search
44
Requires at least: 5.0
5-
Tested up to: 6.3.0
5+
Tested up to: 6.3.1
66
Requires PHP: 7.4
7-
Stable tag: 2.6.0
7+
Stable tag: 2.6.1
88
License: GNU General Public License v2.0, MIT License
99

1010
Use the power of Algolia to enhance your website's search. Enable Autocomplete and Instantsearch for fast and accurate results. Control the look, feel, and relevance.
@@ -125,6 +125,10 @@ All development is handled on [GitHub](https://github.com/WebDevStudios/wp-searc
125125

126126
Follow along with the changelog on [Github](https://github.com/WebDevStudios/wp-search-with-algolia/releases).
127127

128+
= 2.6.1 =
129+
* Fixed: Performance issues related to delete operations.
130+
* Fixed: Performance issues around WP All Import.
131+
128132
= 2.6.0 =
129133
* Added: Support for syncing imported items when "fast mode" from WP All Import enabled.
130134
* Added: Support for updating child posts if parent post's slug has been updated.

algolia.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: WP Search with Algolia
44
* Plugin URI: https://github.com/WebDevStudios/wp-search-with-algolia
55
* Description: Integrate the powerful Algolia search service with WordPress
6-
* Version: 2.6.0
6+
* Version: 2.6.1
77
* Requires at least: 5.0
88
* Requires PHP: 7.4
99
* Author: WebDevStudios
@@ -26,7 +26,7 @@
2626
}
2727

2828
// The Algolia Search plugin version.
29-
define( 'ALGOLIA_VERSION', '2.6.0' );
29+
define( 'ALGOLIA_VERSION', '2.6.1' );
3030

3131
// The minmum required PHP version.
3232
define( 'ALGOLIA_MIN_PHP_VERSION', '7.4' );

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webdevstudios/wp-search-with-algolia",
3-
"version": "2.6.0",
3+
"version": "2.6.1",
44
"description": "Integrate the powerful Algolia search service with WordPress.",
55
"authors": [
66
{

includes/indices/class-algolia-posts-index.php

+14-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,20 @@ private function update_post_records( WP_Post $post, array $records ) {
390390
// If there are no records, parent `update_records` will take care of the deletion.
391391
// In case of posts, we ALWAYS need to delete existing records.
392392
if ( ! empty( $records ) ) {
393-
$this->delete_item( $post, true );
393+
/**
394+
* Filters whether or not to use synchronous wait on record update operations.
395+
*
396+
* @author WebDevStudios <[email protected]>
397+
* @since 2.6.1
398+
*
399+
* @param bool $value Whether or not to use synchronous wait. Default false.
400+
* @param WP_Post $post Current post object being updated.
401+
* @param array $records The records
402+
*
403+
* @return bool
404+
*/
405+
$should_wait = (bool) apply_filters( 'algolia_should_wait_on_delete_item', false, $post, $records );
406+
$this->delete_item( $post, $should_wait );
394407
}
395408

396409
parent::update_records( $post, $records );

includes/indices/class-algolia-searchable-posts-index.php

+14-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,20 @@ private function update_post_records( WP_Post $post, array $records ) {
371371
// If there are no records, parent `update_records` will take care of the deletion.
372372
// In case of posts, we ALWAYS need to delete existing records.
373373
if ( ! empty( $records ) ) {
374-
$this->delete_item( $post, true );
374+
/**
375+
* Filters whether or not to use synchronous wait on record update operations.
376+
*
377+
* @author WebDevStudios <[email protected]>
378+
* @since 2.6.1
379+
*
380+
* @param bool $value Whether or not to use synchronous wait. Default false.
381+
* @param WP_Post $post Current post object being updated.
382+
* @param array $records The records.
383+
*
384+
* @return bool
385+
*/
386+
$should_wait = (bool) apply_filters( 'algolia_should_wait_on_delete_item', false, $post, $records );
387+
$this->delete_item( $post, $should_wait );
375388
}
376389

377390
parent::update_records( $post, $records );

includes/watchers/class-algolia-post-changes-watcher.php

+22-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ class Algolia_Post_Changes_Watcher implements Algolia_Changes_Watcher {
4747
*/
4848
private $posts_updated = [];
4949

50+
/**
51+
* Whether or not we have detected fast mode for a given import.
52+
*
53+
* @author WebDevStudios <[email protected]>
54+
* @since 2.6.1
55+
*
56+
* @var bool
57+
*/
58+
public static $pmxi_is_fast_mode;
59+
5060
/**
5161
* Algolia_Post_Changes_Watcher constructor.
5262
*
@@ -240,10 +250,19 @@ public function track_updated_posts( $post_id ) {
240250
*/
241251
public function sync_item_for_pmxi( $import_id ) {
242252

243-
$import = new PMXI_Import_Record();
244-
$import->getById( $import_id );
253+
if ( null === self::$pmxi_is_fast_mode ) {
254+
try {
255+
$import = new PMXI_Import_Record();
256+
$import->getBy( 'id', $import_id );
257+
258+
self::$pmxi_is_fast_mode = ( ! empty( $import->options['is_fast_mode'] ) );
259+
} catch ( Exception $exception ) {
260+
error_log( $exception->getMessage() ); // phpcs:ignore -- Legacy.
261+
return;
262+
}
263+
}
245264

246-
if ( empty( $import->options['is_fast_mode'] ) ) {
265+
if ( ! self::$pmxi_is_fast_mode ) {
247266
return;
248267
}
249268

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wp-search-with-algolia",
3-
"version": "2.6.0",
3+
"version": "2.6.1",
44
"description": "Integrate the powerful Algolia search service with WordPress.",
55
"author": "WebDevStudios",
66
"license": "GPL-3.0",

0 commit comments

Comments
 (0)