You are viewing limited content. For full access, please sign in.

Question

Question

SDK Freeze issue

asked on November 20, 2023

Hi ,

One of our clients asked us to integrate Laserfiche search and they are facing some issue when searching.

 

while the user search for some documents using Laserfiche search SDK and cancelling it (due to long wait as this query respond need to around 20000 docs and above). while cancelling the system is freezing so, please let me know any time out is there for Laserfiche search SDK. In the backend code the parameter search. Timeout is set to 1 sec, and we are executing the query where the query runs more the timeout condition. it is just an example. Customer will execute the query which runs more than 10 minutes which leads to freezing the system. so, they customer requested to set the timeout to 1 minute and indicate them that the query takes more time

 

 

Thanks ,

Sanjay

0 0

Replies

replied on November 20, 2023

Laserfiche searches do have a time limit you can set on them, exposed in the SDK with the Search.Timeout property. One tip is that especially for larger searches, you probably want to use the BeginRun(false) function. This returns a LongOperation object that you can use to track progress or cancel the search. This is in contrast to Run() or BeginRun(true), which make a blocking/synchronous call, and for a search that takes a long time there's a good chance that an http call somewhere along the line times out before the operation completes.

"Freezing the system" could mean a lot of things and have a lot of root causes and solutions. Can you be more specific about what goes wrong? Does it impact other users?

2 0
replied on November 20, 2023

Thanks Brian. 

 

Looks likes BeginRun will fix the freeze problem and allow user to cancel the query. 

We will implement this and test.

 

Is there any sample code which you can share ?

0 0
replied on November 21, 2023

You can start with something like:

private static void SearchSample()
{
    Search search = MakeSearch();
    LongOperation op = search.BeginRun(false);
    do
    {
        Thread.Sleep(1000);
        op.Refresh();
    }
    while (!op.IsCompleted && !op.IsCanceled && !op.IsCanceling);
    // show the results to the user
}

You'll need to work out how to hook up the user's action to the LongOperation object in order to Cancel() the search.

But it sounds like one of your problems might be that you are doing all this SDK work on your application's UI thread, and so you aren't processing user input - that is one easy way to "freeze" a Windows application. In that case, you'll need to run the code above on a background thread.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.