WooCommerce Attribute being indexed but showing no results

Hi there,

We’re running WordPress 4.7, WooCommerce 2.6.9 and the Algolia 1.6.0.

We’ve got 7 indexes setup:

Searchable posts [searchable_posts]
Posts [posts_post]
Pages [posts_page]
Products [posts_product]
Brands [terms_product_brand]
Product Categories [terms_product_cat]
Full Code [terms_pa_full-code]

The first 6 all return results as expected but Full Code [terms_pa_full-code], although it looks to be indexed returns no results. However, there should be several 100 if not 1000 as if a product had a Full Code it is set to be ‘Visible on the product page’.

Thinking about it more, if a customer searches using the Full Code our expectation would be that it shows the relevant product that uses that Full Code, or if they enter a partial Full Code the products that use that in their Full Code.

Because it’s showing as something that can be indexed I’m assuming we don’t need to do any custom coding?

Thanks,

Hi @freshspace,

Sorry for the delay here,

I understand you are not using our plugin for WooCommerce which would greatly simplify your work here.

Indeed the WooCommerce plugin will automatically index all the attributes listed under “Products -> Attributes” and make it easy to allow your users to filter based on those.

By default the WooCommerce version of the plugin will index SKUs and make them searchable.

Would you consider trying out the Algolia plugin for WooCommerce?

Hi @rayrutjes,

We’re using ‘Search by Algolia – Instant & Relevant results’ Version 1.6.0. We can’t see a separate WooCommerce plugin? If there is one could you direct us to it.

Thanks,
Darren

Hi @rayrutjes,

Any chance we could get the plugin? Urgently trying to get this working before Christmas!

I sent you the plugin by DM :heart:

Let us know how it goes,

Hi @rayrutjes,

We installed the WooCommerce plugin and reindexed.

When trying the search again there is no noticeable difference, trying to search on a SKU offers no results, search on a custom product attribute also returned no result.

In the logs we’ve got 4 error messages, 3 the same - An error occurred while handling task re_index_items. It is gonna be retried and this one - Queue processing stopped after trying to handle task re_index_items 3 times.

Additionally on the search results page it doesn’t show the product categories only the number of products and any other searchable content

Any help would be appreciated.

Thanks,
Darren

The search that is displayed in your screen shot is the global website search.
Have you enabled the search on the “category/tag/search” pages on the Algolia Search -> WooCommerce -> Pages screen?

Also could you try accessing the following link of your website? /?s=&post_type=product

Could you also give me the details of the different errors you have in the logs?

Best,

Hi @rayrutjes,

We hadn’t enabled that but have now, see screen shot

See http://www.cp-cateringequipment.co.uk/?s=&post_type=product, for us possibly because we are logged in as admin we get a dialog box - see below:

But it does show all products in the search result.

Attached 2 error log files, first (https://www.dropbox.com/s/epgvmym9olinihg/error_log.html?dl=0) relates to ‘Queue processing stopped after trying to handle task re_index_items 3 times.’ and second (https://www.dropbox.com/s/0a7byo5fd0oaqrn/error_2.html?dl=0) ‘An error occurred while handling task re_index_items. It is gonna be retried.’

Looking at both error logs they both say ‘Record quota exceeded, change plan or delete records.’. We are using the free plan.

Under Search Page we have ‘Use Algolia with Instantsearch.js’ enabled and because of this we have ‘Searchable posts [searchable_posts]’ ticked as an Indice.

Is it a case that we delete all the records from the Algolia Dashboard and start the sync again?

Thanks,
Darren

Also we haven’t used Zoning because if we do all it does is show a large search box. Is this something we need to do as there is already a search box in place that pulls records through?

@freshspace thanks for taking the time to dump your error messages.
It appears you reached the plan quotas because the following message gets returned: Record quota exceeded, change plan or delete records..

I put @sandy.kwon in the loop so she can help you out getting the most out of your plan.

Regarding the size of the search, you can customize it with custom CSS.

And the products you currently see displayed are not powered by Algolia yet. The message you are getting means the zoning is not correctly configured.

Keep me posted.

@rayrutjes thanks for getting back to us. Ok, that makes sense. Right now were not in a place to be able to pay for the service.

Additionally we’d like to be able to get this working as it should before potentially investing in the service.

In regards to the zoning is there anything you could suggest that might get it to work?

Also, I forgot to ask something, if we went to the Algolia Dashboard and cleared / deleted all the Indices and then reindexed them would that then not mean we would be able to search on SKU / custom product attribute? We assume that it’s not doing that because it isn’t able to reindex?

Thanks,

Hi @freshspace,

Thanks for your feedback, I will make sure a product specialist gets in touch with you.

Regarding the search in SKU, indeed it will only work after a full re-index.

Please bear with us the time we reach out to you.

Hi, well we’ve deleted all the indexes off the Dashboard and we’re in the process of re-indexing now - will let you know how we get on.

In regards to the zoning is there anything you could suggest that might get it to work?.

Hi @rayrutjes,

We deleted the the indexes and it works much better now.

Additionally we also figured out the zoning so that it uses Algolia to power product pages. It does work much quicker and simpler which is great.

Our trouble is that now we have over 30,000 records. However, we don’t need any of the following:

wp_posts_product_post_date_desc
wp_posts_product_average_rating_desc
wp_posts_product_total_sales_desc
wp_posts_product_menu_order_asc

Removing these would save us around 16,000 records but as they are Replica of wp_posts_product if we delete them from the Dashboard they are then indexed again because of the connection back on the website.

Thanks,
Darren

Thanks for the feedback!

By default, Algolia needs 1 index per sorting option.
The sorting options are provided by WooCommerce and we use the same ones.

Here is a snippet you can add to your functions.php file of your theme to remove all the replica indices and keep only the default one:

<?php
add_filter( 'woocommerce_catalog_orderby', function( $wc_options ) {
    $remove_sort_options = array(
        'popularity',
        'rating',
        'date',
        'price',
        'price-desc',
    );
    foreach ( $remove_sort_options as $option ) {
        if ( isset( $wc_options[$option] ) ) {
            unset( $wc_options[$option] );
        }
    }
    return $wc_options;
} );

Note that you will need to manually delete all the other indices from the Algolia dashboard.

Also note that you should keep both the default index and the one suffixed with _menu_order_asc for now. We still need to merge the default index and that one. Probably in the next release :wink:

Let me know if that works for you, I didn’t test the code so I hope it runs fine :wink:

Hi @rayrutjes,

Thanks for this. We’ll give it a go.

Thanks,
Darren