Developer forum

Forum » Ecommerce - Standard features » Relevance in ecom suggested search

Relevance in ecom suggested search

Matthijs Hofstede
Reply
Hi,

We notice the results we get in our suggested search are correct but not as you would like them to be. Just take a look at the site (http://www.cookandco.nl/) and start searching with just 1 letter (for example the letter b). You will see all products that contain this letter but the first results look rather random to us (first result is Neo Berghoff). It makes sense to show products that start with the letter "b". Does anyone know a way to influence this result?


Replies

 
Pavel Volgarev
Reply
Hi Martthijs,

The reason why you get this product is that the system takes not only the product name into consideration but all the fields that contain any text (for example, short/long description). Furthermore, such fields are tokenized before they're put into the index meaning that you can't really search for something that starts with a given word or phrase. A search for "b" will find all products that contain the letter "b" as a standalone token. A search for "b*" will find all products that contain a token that starts with a letter "b" and so on.

You can change the order of your products (or event remove results that you don't want to show) by subscribing to Dynamicweb.Notifications.eCommerce.ProductList.BeforePaging notification.

-- Pavel 
 
Pavel Volgarev
Reply
Hi Martthijs,

Sorry, I misunderstood your question a bit. The notification that I mentioned in my previous post will not help you because it's not fired in this case.

What you can do is you can filter results on the client using JavaScript. Open your template that contains the setup for Instant Search (usually it's either /Files/Templates/Filter/TextFilterAdvanced.html or /Files/Templates/Filter/TextFilterSuggestions.html) and edit the section that initializes the Suggested Queries functionality the following way:
Dynamicweb.Frontend.InstantSearch.setEnableSuggestions('txFreeTextQuery', true, {
    boxID: 'divSuggestions',
    onItemDataBound: function(sender, args) {
        var canShow = true;
        var suggestion = args.data;

        /* Filter out results here */

        if (!canShow) $(args.item).hide();
    }
});
Here I use "itemDataBound" event to determine if the item can be shown in the list.

Hope this helps.

-- Pavel
 
Matthijs Hofstede
Reply
Hi Pavel,

Thanks for your quick reaction. It sure helps.

If i understand you correct in your example you exclude some off the items with javascript (for example everything not starting with the letter you just typed)

And you can not influence the order off the results?

Matthijs

 
Pavel Volgarev
Reply
Hi Matthijs,

I'm sorry, but it's not possible right now.

-- Pavel
 
Matthijs Hofstede
Reply
Hi,

Can you guys look into it and make it a feature request? Imho you would like to have something to sort the results. The results you get now are not the ones a user would expect. Expeccialy with a hight number of products.

If it will be marked as a feature request could you post the number for future reference?

Gr. Matthijs

 

You must be logged in to post in the forum