Developer forum

Forum » Development » Replace DW search

Replace DW search

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I have a potential project where we're looking at integrating an external search engine. I am still exploring its capabilities but in essence we can send it a search term and then we get rich product data back.

Has anyone done this before and do you have any pointers on how to implement? I think there are a few challenges:

1. One option is to just fetch the product numbers from the external tool and use the standard DW index to display them by posting product numbers to a search page. However, I think that may mess up sorting as documents are sorted by default on the DW score, not on the order I feed the IDs. The benefit would be that other things, like product rendering, live prices and more probably just continue to work.

2. If we take all their data instead and keep iot in their sort order, that means we need to render custom UI for the results and possibly also for facets which adds another layer of complexity. Also, things like stock and prices may have to be reimplemented.

I found this post that seems related to what I am doing: https://doc.dynamicweb.com/forum/development/development/ability-to-set-totalproductcount However, it seems that approach was abandoned because of some issues.

I remember we had an external recommendation engine some years ago. Did that do the same thing and is that source code still available somewhere?

Thanks in advance,

Imar


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Imar

To my knowledge, we have one customer that has implemented Azure search to do the same. They bypass the product list.

The indexing and querying is actually an abstraction where our implementation is an add-in using Lucene. However, I know of no implementations that take over full control and there might be corners of our implementation that would limit your options.

The product catalog for viewmodel app, has a notification you can hook into:

Notifications.Ecommerce.ProductCatalog.OnBeforeProductListRender

It will pass you a list of autoids from the index that will be rendered - you can also overwrite that list of AutoIDs inside the notification subscriber and then those autoids will be used to the rendering, including the order of rendering. So this might be the easiest way to do it. This solves the product list - facets is another thing, but I guess you get that back from the external search as well and can just render it.

BR Nicolai

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Thanks Nicolai!

>> you can also overwrite that list of AutoIDs inside the notification subscriber and then those autoids will be used to the rendering, including the order of rendering.

Nice. I also saw that in the post I referenced, but back then there was an issue with the total count. Is that still a problem? If, yes, then I guess I also need to implement my own paging.

>> but I guess you get that back from the external search as well and can just render it.

Yes, the API exposes that information too. We just haven't decided to use DW facets and send those on to the API for filtering, or that we should also completely switch over to their facets. We'll have to look into that further.

I'll start experimenting with OnBeforeProductListRender and see how far I get.

Thanks!

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Yeah, there might be issues with totals and page sizes in that notification.

You also have Notifications.Ecommerce.Querying.BeforeQueryDatabase which will give you the result of the search. The argument to that notification, BeforeQueryDatabaseArgs has a result that you can overtake - and TotalCount of that result (IQueryResult) is the one used. So maybe that is a better place to hook into the hole thing. That result also contains facets.

If you use an external search engine, you will need to take over everything related to search - term suggestions, results and facets - otherwise you will run into number mismatch.

BR Nicolai

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Thanks, I'll look into BeforeQueryDatabase also.

>> If you use an external search engine, you will need to take over everything related to search - term suggestions, results and facets - otherwise you will run into number mismatch.

Yes, thanks, I am aware of the minefield I am stepping into :-)

Imar

 

You must be logged in to post in the forum