• Resolved Steve

    (@thewebsmiths)


    Hi,
    Is there a way to reduce the size of wp_aws_index?
    Mine is causing delays in database backups.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hi,

    Yes, it is possible. You can remove from the index table all source that you are not using for searching.
    For example following code remove all sources except title, content and sku of product.

    add_filter('aws_indexed_data', 'my_aws_indexed_data');
    function my_aws_indexed_data( $data ) {
        $new_terms = array();
        foreach ( $data['terms'] as $source => $all_terms ) {
            if ( strpos( $source, 'title' ) === 0 || strpos( $source, 'sku' ) === 0 || strpos( $source, 'content' ) === 0 ) {
                $new_terms[$source] = $all_terms;
            }
        }
        $data['terms'] = $new_terms;
        return $data;
    }

    You need to add it somewhere outside plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets like
    https://wordpress.org/plugins/code-snippets/. Also, after adding this code, you need to re-index plugin table.

    Regards

    Thread Starter Steve

    (@thewebsmiths)

    Thank you @mihail-barinov

    The client searches in Title, SKU and Short description only (in the AWS Search Sources settings).

    Would I simply swap ‘content’ for ‘excerpt’ in your provided code?

    So:

    add_filter('aws_indexed_data', 'my_aws_indexed_data');
    function my_aws_indexed_data( $data ) {
        $new_terms = array();
        foreach ( $data['terms'] as $source => $all_terms ) {
            if ( strpos( $source, 'title' ) === 0 || strpos( $source, 'sku' ) === 0 || strpos( $source, 'excerpt' ) === 0 ) {
                $new_terms[$source] = $all_terms;
            }
        }
        $data['terms'] = $new_terms;
        return $data;
    }
    Plugin Author ILLID

    (@mihail-barinov)

    Yes, this code should work as you want.

    Thread Starter Steve

    (@thewebsmiths)

    Thanks @mihail-barinov

    Would I need to reindex table or clear the cache within the AWS settings after adding this?

    Plugin Author ILLID

    (@mihail-barinov)

    Yes, you will need to re-index plugin table after adding this code.

    Thread Starter Steve

    (@thewebsmiths)

    Thank you @mihail-barinov

    Both the customer & I love the Advanced Woo Search functionality and speed.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘wp_aws_index size issue’ is closed to new replies.