Developer forum

Forum » Development » Diffrent types of content in same index

Diffrent types of content in same index

Aki Ruuskanen
Aki Ruuskanen
Reply

Hi,

In a project we have a design where different types of content are displayed in the same search result list. 

So we need to mix product, content and user indexes. I have done this before by simply building an own IndexBuilder that retrieves all the needed data and puts it in an index. 

My question is if there is any other approach to this? Its not so optimal in a solution with lots of Items. 

Regards / Aki


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Aki,

 

If you're willing to use multiple paragraphs, one for each content type, this is very easy. Otherwise, currently it can be rather complex.

 

From the way you're describing, looks like you need to either have a custom IndexBuilder OR use the SQL Index builder using a very complex query to union all of the necessary data in a single result. Once you're there, is standard management of Repositories. 

 

Assuming you'll still be having separate searches for users, products and content, every time you change settings in one (i.e. add another field OR change boost values), you need to change the other one too.

 

Please consider that if you are using partial index builds (products and users), you'll have to subscribe to Product and User Save notifications to rebuild your custom index as well.

 

Hope this helps.

 

Nuno Aguiar

 
Aki Ruuskanen
Aki Ruuskanen
Reply

Hi Nuno,

Thanks for your input. I actually did it with a custom index like that in a previous project. But as you mention, the data collection can be a bit complex. 

But if the requirements are one single sortable search result list with everything mixed I guess its hard to do otherwise.

Regards / Aki. 

 

You must be logged in to post in the forum