• Hi there,
    is there any way to optimize my DB since aws made my shop rly slow?

    I only need “SKU” and “title” search.
    I have used the following code.
    But my AWS_index table still looks like this:(image attatched)

    Can I just delete all and rescan?
    or delete all columns (term_source, type, count, in_stock, on_sale, term_id, visibility,) in phpmyadmin that i dont need?
    And the lines for: not SKU / not title.

    Like I said I only need AWS to search for SKUs and Titles of Products.

    Kind Regards
    Dave
    Picture of DB:
    https://we.tl/t-Bi55CDfvWk

    //aws search filter

    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 ) {
    $new_terms[$source] = $all_terms;
    }
    }
    $data[‘terms’] = $new_terms;
    return $data;
    }

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

    (@mihail-barinov)

    Hello,

    Well your code

    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 ) {
                $new_terms[$source] = $all_terms;
            }
        }
        $data['terms'] = $new_terms;
        return $data;
    }

    looks good. So just add it to your site and then re-index plugin table from the plugin settings page. This must works for you.

    Regards

    Thread Starter llndave

    (@llndave)

    its your code 🙂
    i added it and then reindexed before my ticket here.
    But it doesnt delete the columns and lines i dont need :S
    should i delete them and then reindex or is the code not working?

    Plugin Author ILLID

    (@mihail-barinov)

    Strange. Can you please tell me where you add this code snippet? Or better – show me this via some screenshot.

    Thread Starter llndave

    (@llndave)

    child theme functions.php
    the functions.php works fine since i have 10 ish codes running

    Plugin Author ILLID

    (@mihail-barinov)

    It is still strange, because this code must work. Maybe you are using the same filter aws_indexed_data also somewhere else inside you theme and this filter overwrites indexed data?

    Also – maybe you can try, for test purposes, add this code somewhere else and try to re-index the table? Then this code can be removed.

    Regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Slow Database @ AWS’ is closed to new replies.