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

Question

Question

LaunchSearch CAT Method Results Empty

SDK
asked on June 7, 2018

When running the below code, the Client opens, the search runs, and the results are displayed. There are 3 results. However, the count inside the "results" variable is 0 so iterating through them and opening the documents with the IDs inside does nothing. Am I doing something wrong?

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Laserfiche.ClientAutomation;


namespace OpenDocsWithSDKTest
{
    class Program
    {
        static void Main(string[] args)
        {
            OpenDocumentSample();
        }

        static MainWindow LaunchClientSample2()
        {
            LaunchOptions launchOptions = new LaunchOptions();
            launchOptions.ServerName = "server";
            launchOptions.RepositoryName = "repository";
            using (ClientManager clientMgr = new ClientManager())
            {
                MainWindow mainWindow = null; // mainWindow represents the folder browser window
                clientMgr.LogIn(launchOptions, out mainWindow);
                return mainWindow;
            }
        }

        static void OpenDocumentSample()
        {
            MainWindow mainWindow = LaunchClientSample2();

            SearchOptions so = new SearchOptions();
            so.NewWindow = false;
            so.Query = @"{LF:Name=""*"",type=D} & {LF:Tags=""MyTag""}";
            var results = new List<int>();
            results = mainWindow.LaunchSearch(so) as List<int>;

            OpenOptions options = new OpenOptions();
            options.OpenStyle = DocumentOpenType.DocumentViewer;

            foreach (var ID in results)
            {
                mainWindow.OpenDocumentById(ID, options);
            }
            Console.WriteLine(results.Count());
        }

    }
}
0 0

Answer

SELECTED ANSWER
replied on June 7, 2018

Set so.EagerlyRetrieveResults=true to have the entry IDs returned.

1 0
replied on June 7, 2018

The documentation for the LaunchSearch method lists the Return Value as "A list of entry IDs that match the search criteria," so I didn't think that it would not be default behavior. I think the documentation should clarify that it only returns that list if EagerlyRetrieveResults is set to true.

 

Thanks, Robert

0 0

Replies

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

Sign in to reply to this post.