Support » Plugin: Advanced Woo Search » auto reindex or with cron?
auto reindex or with cron?
-
Hi,
is there any way to auto reindex or with cron periodicaly? for exemple every hour.Thank’s and great plugin!
David
-
Hello,
Yes, it is possible. You just need to call ‘aws_reindex_table’ action.
Its can be done with this code:do_action('aws_reindex_table');
If you want to add this action as cron job you can do something like
add_action( 'wp', 'aws_set_cron' ); function aws_set_cron() { if ( ! wp_next_scheduled ( 'aws_reindex_table' ) ) { wp_schedule_event(time(), 'hourly', 'aws_reindex_table'); } }
This code will run re-index cron job every hour.
Thank you Illid! 🙂
One question. Is necessary reindex manually AWS every time I import products or AWS reindex itseft?
DAvid
AWS plugin must re-index all imported content automatically.
But its depends on way that you import this products.I import with WP All import (www.wpallimport.com)
DAvid
Well its must work with this plugin.
Thank’s Illid!
best regards,
DavidHello,
I tried creating the following script but is not working.
Please help. The only thing I get are the following warnings:Notice: Undefined index: data in /var/www/vhosts/apopou.com/httpdocs/wp-content/plugins/advanced-woo-search/includes/class-aws-table.php on line 57
Notice: Undefined index: offset in /var/www/vhosts/apopou.com/httpdocs/wp-content/plugins/advanced-woo-search/includes/class-aws-table.php on line 93
Notice: Undefined index: offset in /var/www/vhosts/apopou.com/httpdocs/wp-content/plugins/advanced-woo-search/includes/class-aws-table.php on line 116
Notice: Undefined index: found_posts in /var/www/vhosts/apopou.com/httpdocs/wp-content/plugins/advanced-woo-search/includes/class-aws-table.php on line 118
Notice: Undefined index: found_posts in /var/www/vhosts/apopou.com/httpdocs/wp-content/plugins/advanced-woo-search/includes/class-aws-table.php on line 119
My code:
<?php
require_once(dirname(__FILE__) . ‘/../../wp-load.php’);
require_once(dirname(__FILE__) . ‘/../../wp-includes/plugin.php’);
ini_set(‘memory_limit’, ‘-1’);ini_set(‘display_errors’, 1);
ini_set(‘display_startup_errors’, 1);
error_reporting(E_ALL);do_action(‘aws_reindex_table’);
Hello,
Thanks for letting me know about this problem.
It is the bug that exists during last few plugin versions.
Before I release new update you can quickly fix it by yourself.Please open includes/class-aws-table.php, find line
$index_meta = $_POST['data'];
and replace with
$index_meta = $return ? $return : $_POST['data'];
Also find
public function reindex_table_job() { do { $meta = $this->reindex_table( true ); $offset = (int) isset( $meta['offset'] ) ? $meta['offset'] : 0; $start = (int) isset( $meta['start'] ) ? $meta['start'] : 0; } while ( !( $offset === 0 && ! $start ) ); }
and replace with
public function reindex_table_job() { $meta = 'start'; do { $meta = $this->reindex_table( $meta); $offset = (int) isset( $meta['offset'] ) ? $meta['offset'] : 0; $start = (int) isset( $meta['start'] ) ? $meta['start'] : 0; } while ( !( $offset === 0 && ! $start ) ); }
After this changes all must work fine.
- This reply was modified 5 years, 12 months ago by ILLID.
- The topic ‘auto reindex or with cron?’ is closed to new replies.