Manh Nguyen
Aug 30, 2024
  202
(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
Streamlining Marketing Success: The Benefits for Optimizely One with Perficient

As an Optimizely expert, I eagerly anticipate this time of year due to the exciting Optimizely events happening worldwide. These include Opticon, t...

Alex Harris - Perficient | Sep 17, 2024 | Syndicated blog

Creating an Optimizely Addon - Packaging for NuGet

In   Part One   and   Part Two   of this series; I covered topics from having a great idea, solution structure, extending the menus and adding...

Mark Stott | Sep 16, 2024

Optimizely CMS and weekly updates

Learn how reporting bugs in Optimizely CMS not only helps improve the platform but also benefits you and the entire user community.

Tomas Hensrud Gulla | Sep 12, 2024 | Syndicated blog

Introduce the ablility to select then delete items manually on FIND UI

In FIND 16.3.0 we introduce an ability to select items and delete them manually, it will helps you to delete unexpected items from the UI without a...

Manh Nguyen | Sep 12, 2024