Developer forum

Forum » Integration » SQL Index builder, partial index

SQL Index builder, partial index

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I know this subject was touched upon in the past but I could not find a solution.

Can we add a partial index builder for the SQL index builder? Or any other way I can index the deltas and avoid reindexing everything?

Thank you,

Adrian


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Adrian

It is not super simple since it is very generic.

The productindexbuilder knows it is indexing products and what column to look at deciding what to build - so when called with update, it will only index products that are updated.

But you can set it up using 2 builds with similar SQLs and then 2 tasks with different schedules - like my example below that indexes all pages:

 

 

 

The tasks:

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

That is a neat trick

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Neat trick indeed :)

Can I then call the Update build from my code (say, a notification)?

I am trying to update the partial build everytime a new record is added. Similar to how you do the update for ProductIndex when a product is saved.

Thank you,

Adrian

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Yeah - almost. My example actually only almost works. Because when the update runs it will clear the index and only add the updated records to the new index.

But I just made a quick change to the SQL provider so it can support this. It will require that the SQLs delivers an id that can be used for the update - so something like this:

Select *, PageID AS IndexUpdateID FROM page

Instead of

Select *, PageID AS IndexUpdateID FROM page

Then the indexbuilder will have 2 actions - "Execute" like now and a new "Update" that will look at this field.

But it requires that you get an update of the SQL builder. I can give you the code so you can rename it and add it to your poject as an extension untill released (attached)

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Cool!

Thank you!

Adrian

 

You must be logged in to post in the forum