Hi Guys,
Is it possible to use ProductCatalog module with a SQLIndex Query?
Are there any mandatory fields that have to be included in order to make the module recognize the Index as a product index?
Thanks,
Adrian
Hi Guys,
Is it possible to use ProductCatalog module with a SQLIndex Query?
Are there any mandatory fields that have to be included in order to make the module recognize the Index as a product index?
Thanks,
Adrian
No, that is not possible. The catalog requires the product index.
But you can create a ProductIndexSchemaExtender to extend the index made by the ProductIndexBuilder
I need to make a join with another table. Is this possible with ProductIndexSchemaExtender?
Thanks,
Adrian
Hi Adrian
Well, I've given you the wrong answer. You need to create a IndexBuilderExtender.
An example:
class IndexBuilderExtenderExample : Indexing.IndexBuilderExtenderBase<Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder>
{
public override void ExtendDocument(IndexDocument document)
{
if (document.ContainsKey("ID"))
{
string productid = (string)document["ID"];
}
document.Add("CustomField", DateTime.Now);
}
}
So you cannot join a table to the product - the ExtendDocument is called once for each product being indexed. You can simple look up the missing data using SQL and add it to the document.
Of course that would give one SQL per product. Maybe, only maybe, you want to select all the data on first product, cache it, and look up for the next products. If data is different for each product and you have many products, you might want to look up data for each product.
NP
Thank you Nicolai.
In our case it's gonna be pretty performance sensitive since we have to make a join with a huge table (160.000.000 records if I understood it correctly)
I will probably use the SQL Index builder and mimic the Product Listing, then send to a proper ProductDetail Page.
In the ProductList I only need a couple of fields.
I will keep this in mind anyway for future cases.
Thank you,
Adrian
Hi Nicolai,
Based on your example, we assued "CustomField" would be a property created by the extender. With that in mind we expected it to show in the Source dropdown (check attachment).
To be sure the extender was working we successsfully updated existing properties
if (doc.ContainsKey("ProductID")) { doc["ProductID"] = "newValue"; }
What am I missing?
Best Regards,
Nuno Aguiar
Hi Nuno
The dump you have is from where you setup the index to build (before it is being build), and the extender you have created runs when the index is being build. So you cannot see a field in the before build step that you create in the build step... The list of fields comes from the shcema extender - you can also override that one, or inherit it and add you own field.
So if you add a new field during the build using the above method, that field is only available when you setup the search based on that index.
BR Nicolai
Hi Nicolai,
If I understood you correctly I should have it available in the Query, so that I could set an expression for it, correct? Check this screencast and I am also attaching the VS project just in case (very basic setup)
http://screencast.com/t/INQJ9FIy7T
Best Regards,
Nuno Aguiar
You must be logged in to post in the forum