Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.

 

Manh Nguyen
Aug 30, 2024
  355
(1 votes)

Configure your own Search & Navigation timeouts

The main blog Configure your own Search & Navigation timeouts was posted for years but you need copy the code to your application.

We now bring those code to FIND 16.3.0 and you just need to call SetTimeout(/*timeout in milliseconds*/) method fo make your request works. Both Search and MultiSearch request will work with SetTimeout from FIND 16.3.0.

var searchResults = SearchClient.Instance.Search<IContent>().For("alloy").SetTimeout(10000).GetContentResult();

var multiSearchResults = SearchClient.Instance..MultiSearch<IContent>()
                        .Search<IContent>(x => x.For("test1").InField(f => f.Name))
                        .Search<IContent>(x => x.For("test2").InField(f => f.Name))
                        .SetTimeout(10000) 
                        .GetContentResult());

Please contact us if you have any question or feedback.

Aug 30, 2024

Comments

Antti Alasvuo
Antti Alasvuo Sep 3, 2024 06:33 AM

Just to clarify, the point here is that you can set custom timeout per query using the ".SetTimeout(12345)", but still the appsettings.json Find options are also used, so there is one plave were you can set the default timeout, right?

Like so:

"EPiServer": {
  "Find": {
    "TrackingSanitizerEnabled": true,
    "TrackingTimeout": 5000,
    "DefaultRequestTimeout": 10000
  }
}

Can't find link to the Search and Navigation full configuration, but anyone can look at the source of FindOptions class to see all properties that can be set here.

Manh Nguyen
Manh Nguyen Sep 4, 2024 01:54 AM

Yes you're right, DefaultRequestTimeout is a default timeout value for all requests (default is 100 seconds if not config). But from version FIND 16.3.0 you can override that value for the search request by using SetTimeout() to avoid waiting too long if network or server is in a unstable state.

Please login to comment.
Latest blogs
Level Up with Optimizely's Newly Relaunched Certifications!

We're thrilled to announce the relaunch of our Optimizely Certifications—designed to help partners, customers, and developers redefine what it mean...

Satata Satez | Jan 14, 2025

Introducing AI Assistance for DBLocalizationProvider

The LocalizationProvider for Optimizely has long been a powerful tool for enhancing the localization capabilities of Optimizely CMS. Designed to ma...

Luc Gosso (MVP) | Jan 14, 2025 | Syndicated blog

Order tabs with drag and drop - Blazor

I have started to play around a little with Blazor and the best way to learn is to reimplement some old stuff for CMS12. So I took a look at my old...

Per Nergård | Jan 14, 2025

Product Recommendations - Common Pitfalls

With the added freedom and flexibility that the release of the self-service widgets feature for Product Recommendations provides you as...

Dylan Walker | Jan 14, 2025

My blog is now running using Optimizely CMS!

It's official! You are currently reading this post on my shiny new Optimizely CMS website.  In the past weeks, I have been quite busy crunching eve...

David Drouin-Prince | Jan 12, 2025 | Syndicated blog

Developer meetup - Manchester, 23rd January

Yes, it's that time of year again where tradition dictates that people reflect on the year gone by and brace themselves for the year ahead, and wha...

Paul Gruffydd | Jan 9, 2025