Skip to content

Commit

Permalink
Release 2.6.1 (#362)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tw2113 authored Sep 12, 2023
1 parent fcab8a4 commit fe87240
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 11 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## 2.6.1

* Fixed: Performance issues related to delete operations.
* Fixed: Performance issues around WP All Import.

## 2.6.0

* Added: Support for syncing imported items when "fast mode" from WP All Import enabled.
* Added: Support for updating child posts if parent post's slug has been updated.
* Added: Support for updating posts when an associated term has been updatd.
* Added: Wait for delete operations to complete before moving to updates.
* Updated: Algolia Search library to 4.18.x
* Updated: InstantSearch library to 4.56.x

## 2.5.4

* Updated: Ensure reindexing completes when using the from_batch flag with CLI.
* Updated: Assigned Algolia_Admin instance to a property for access elsewhere.

## 2.5.3

* Updated: Autocomplete template file with user link fix when cmd/ctrl clicking.
Expand Down
8 changes: 6 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Contributors: WebDevStudios, williamsba1, tw2113, mrasharirfan, scottbasgaard, gregrickaby, richaber
Tags: search, algolia, autocomplete, instantsearch, relevance search, faceted search, find-as-you-type search, ecommerce, seo, woocommerce, advanced search
Requires at least: 5.0
Tested up to: 6.3.0
Tested up to: 6.3.1
Requires PHP: 7.4
Stable tag: 2.6.0
Stable tag: 2.6.1
License: GNU General Public License v2.0, MIT License

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.
Expand Down Expand Up @@ -125,6 +125,10 @@ All development is handled on [GitHub](https://github.com/WebDevStudios/wp-searc

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

= 2.6.1 =
* Fixed: Performance issues related to delete operations.
* Fixed: Performance issues around WP All Import.

= 2.6.0 =
* Added: Support for syncing imported items when "fast mode" from WP All Import enabled.
* Added: Support for updating child posts if parent post's slug has been updated.
Expand Down
4 changes: 2 additions & 2 deletions algolia.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WP Search with Algolia
* Plugin URI: https://github.com/WebDevStudios/wp-search-with-algolia
* Description: Integrate the powerful Algolia search service with WordPress
* Version: 2.6.0
* Version: 2.6.1
* Requires at least: 5.0
* Requires PHP: 7.4
* Author: WebDevStudios
Expand All @@ -26,7 +26,7 @@
}

// The Algolia Search plugin version.
define( 'ALGOLIA_VERSION', '2.6.0' );
define( 'ALGOLIA_VERSION', '2.6.1' );

// The minmum required PHP version.
define( 'ALGOLIA_MIN_PHP_VERSION', '7.4' );
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webdevstudios/wp-search-with-algolia",
"version": "2.6.0",
"version": "2.6.1",
"description": "Integrate the powerful Algolia search service with WordPress.",
"authors": [
{
Expand Down
15 changes: 14 additions & 1 deletion includes/indices/class-algolia-posts-index.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,20 @@ private function update_post_records( WP_Post $post, array $records ) {
// If there are no records, parent `update_records` will take care of the deletion.
// In case of posts, we ALWAYS need to delete existing records.
if ( ! empty( $records ) ) {
$this->delete_item( $post, true );
/**
* Filters whether or not to use synchronous wait on record update operations.
*
* @author WebDevStudios <contact@webdevstudios.com>
* @since 2.6.1
*
* @param bool $value Whether or not to use synchronous wait. Default false.
* @param WP_Post $post Current post object being updated.
* @param array $records The records
*
* @return bool
*/
$should_wait = (bool) apply_filters( 'algolia_should_wait_on_delete_item', false, $post, $records );
$this->delete_item( $post, $should_wait );
}

parent::update_records( $post, $records );
Expand Down
15 changes: 14 additions & 1 deletion includes/indices/class-algolia-searchable-posts-index.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,20 @@ private function update_post_records( WP_Post $post, array $records ) {
// If there are no records, parent `update_records` will take care of the deletion.
// In case of posts, we ALWAYS need to delete existing records.
if ( ! empty( $records ) ) {
$this->delete_item( $post, true );
/**
* Filters whether or not to use synchronous wait on record update operations.
*
* @author WebDevStudios <contact@webdevstudios.com>
* @since 2.6.1
*
* @param bool $value Whether or not to use synchronous wait. Default false.
* @param WP_Post $post Current post object being updated.
* @param array $records The records.
*
* @return bool
*/
$should_wait = (bool) apply_filters( 'algolia_should_wait_on_delete_item', false, $post, $records );
$this->delete_item( $post, $should_wait );
}

parent::update_records( $post, $records );
Expand Down
25 changes: 22 additions & 3 deletions includes/watchers/class-algolia-post-changes-watcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ class Algolia_Post_Changes_Watcher implements Algolia_Changes_Watcher {
*/
private $posts_updated = [];

/**
* Whether or not we have detected fast mode for a given import.
*
* @author WebDevStudios <contact@webdevstudios.com>
* @since 2.6.1
*
* @var bool
*/
public static $pmxi_is_fast_mode;

/**
* Algolia_Post_Changes_Watcher constructor.
*
Expand Down Expand Up @@ -240,10 +250,19 @@ public function track_updated_posts( $post_id ) {
*/
public function sync_item_for_pmxi( $import_id ) {

$import = new PMXI_Import_Record();
$import->getById( $import_id );
if ( null === self::$pmxi_is_fast_mode ) {
try {
$import = new PMXI_Import_Record();
$import->getBy( 'id', $import_id );

self::$pmxi_is_fast_mode = ( ! empty( $import->options['is_fast_mode'] ) );
} catch ( Exception $exception ) {
error_log( $exception->getMessage() ); // phpcs:ignore -- Legacy.
return;
}
}

if ( empty( $import->options['is_fast_mode'] ) ) {
if ( ! self::$pmxi_is_fast_mode ) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-search-with-algolia",
"version": "2.6.0",
"version": "2.6.1",
"description": "Integrate the powerful Algolia search service with WordPress.",
"author": "WebDevStudios",
"license": "GPL-3.0",
Expand Down

0 comments on commit fe87240

Please sign in to comment.