Developer forum

Forum » Ecommerce - Standard features » Repository Indexing for Search/Filtering Criteria

Repository Indexing for Search/Filtering Criteria

Kevin O'Driscoll
Reply

Questions for the Class:

Im investigating some approaches to provide a comprehensive catalog search/filter criteria to the UI. 
The UI will be a mixture of Selects, Multiselects, Checkboxes, Radios and Free Text searchboxes and maybe a price range slider.
The data for the UI will come from the EcomProduct, EcomGroup and EcomVariant entities, and only for active products and 
Products that only exist in any eComCatalog Module (there are many in the solution) by Area.
The controls will be created on the fly from the criterion data produced from the entities and therefore will be close to providing the 
correct (available) criterion to achieve a successful result from criterion combinations selected.

The scenario is a DW 9.4.10 solution with 7 websites (in 6 languages). Each website uses the same product base but translated as are the Group names and the Variant names.
Product has about 10 custom fields. The Groups allow 4-5 catalog "sections" to be devised, and the criteria UI will provide the correct search criterion controls for each section 
to be rendered correctly. All Data is imported under an integration job from an erp.

I have something kinda working already, but I want to speed up the process (the rendering takes about 3000-4000ms on the first load, then after about 250ms) 
and I think this could be achieved using the Repository Indexing in DW.

Is there a way in DW Indexing to build the criterion data only, from the 3 Ecom Entities? 
Do I need a Custom IndexBuilder or extend ProductIndexBuilder (eg. does this builder include Groups and Variants too?).

Querying the Index could be quite straight forward with about 4 parameters AreaID LANGID SHOPID and "SectionID"

Is it possible? Any pointers or ideas, comments would be welcome.


Replies

 
Nicolai Pedersen
Reply

Hi Kevin

This is exactly what indexing does in Dynamicweb. The index contains one Lucene document per product and variant for each language. So if you have a product in 2 colors and 2 sizes in 2 languages you would have up to 8 documents for that product, and you can use context information like language, shop id etc. to find the right ones.

The product index builder also indexes variant information and group information. You may want to read some of the docs found here:

http://doc.dynamicweb.com/documentation-9/platform

So you do not need a custom index builder. If the index is missing a bit of information, you can use a IndexBuilderExtender:

https://doc.dynamicweb.com/api/html/7543c5fc-9943-dd59-a613-30e44bf6ab01.htm

It would look something like this and can be used to add custom data to each document of the product index builder:

using Dynamicweb.Indexing;
using Dynamicweb.Ecommerce.Indexing;
using System;

namespace Dynamicweb.Ecommerce.Examples
{
    class IndexBuilderExtenderExample : IndexBuilderExtenderBase<ProductIndexBuilder>
    {
        public override void ExtendDocument(IndexDocument document)
        {
            if (document.ContainsKey("ID"))
            {
                string productid = (string)document["ID"];
            }

            if (document.ContainsKey("ProductNumber"))
            {
                string productNumber = (string)document["ProductNumber"];
                document.Add("ProductNumberCleaned", productNumber.Replace(".", string.Empty));
            }

            document.Add("CustomField", DateTime.Now);
        }
    }
}

BR Nicolai

 

You must be logged in to post in the forum