Take the community feedback survey now.

Optimizely Find Search - Decision between making multiple smaller queries or loading 1000 results in one go

Vote:
 

We have a scenario where need to select top 3 results for six different page types post a search.

Performance wise - 

a) Is it better to load 1000 results and then filter and sort by each page type and pick the top 3 from each result set.

This approach has a memory impact as we are loading 1000 resuts on every page load.

b) Or is it better to make 6 different queries to get only 3 results from each result set.

This approach makes 6 search requests instead of 1. But only get 18 relevant results

 

#340170
Sep 01, 2025 9:10
Vote:
 

Hi Sandeep,

I would opt for b) but also using 6 threads to send requests concurently, join them with Task.WhenAll().

Best regards,
MilosR

#340303
Sep 09, 2025 10:13
Vote:
 

It also depends on if you are using GetResult or GetContentResult. The later won't be fast with cold cache and 1000 result items.

Multi-search might be an option to look for also, then you only need one round-trip to service.

https://docs.developers.optimizely.com/content-management-system/v1.1.0-search-and-navigation/docs/multiple-searches-in-one-request 

#340328
Sep 10, 2025 6:00
Vote:
 

Thanks for the suggestions. Please see below full solution 

var searchContext = await client
     .MultiSearch<MultiSearchResult>()  
     .Search<ArticlePage, MultiSearchResult>(x =>
         x.For(query.SearchTerm)
         .FilterForVisitor()
         .Track()
         .StaticallyCacheFor(CacheTimeSpan)
         //.InField(y => y.Title)
         //.InField(y => y.Summary)
     .Search<StandardPage, MultiSearchResult>(x =>
         x.For(query.SearchTerm)
         .FilterForVisitor()
         .Track()
         .StaticallyCacheFor(CacheTimeSpan)
         //.InField(y => y.Title)
         //.InField(y => y.Summary)  
         .Filter(x => x.ParentLink.ID.Match(query.RootHelpPageLink.ID))
         .Select(r => new MultiSearchResult
         {
             HelpSearchResult = new GlobalSearchResult
             {
                 Title = r.Title,
                 Summary = r.Summary
             }
         }).Take(multiSearchQuery.PageSize))
     .Search<StandardPage, MultiSearchResult>(x =>
         x.For(query.SearchTerm)
         .FilterForVisitor()
         .Track()
         .StaticallyCacheFor(CacheTimeSpan)
         //.InField(y => y.Title)
         //.InField(y => y.Summary)
         .Filter(x => !x.ParentLink.ID.Match(query.RootHelpPageLink.ID))
         .Select(r => new MultiSearchResult
         {
             GlobalSearchResult = new GlobalSearchResult
             {
                 Title = r.Title,
                 Summary = r.Summary
             }
         }).Take(multiSearchQuery.PageSize)).GetResultAsync();

#340493
Sep 22, 2025 16:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.