Exemple #1
0
        public async Task Start(SearchRequest sr, SearchCallback <SearchStatus> statusCallback)
        {
            this.Callback = statusCallback;
            this.Request  = sr;
            this.Request.FilterListChanged += OnFilterListChanged;
            this.Request.SortingChanged    += OnSortOrderChanged;

            FakeHits = null;


            Pici.Log.debug(typeof(SearchSession), "searching:" + sr.SearchString);
            ID = await PP2_Init();

            if (ID > 0)
            {
                //run query if successfully initiated session
                try
                {
                    Callback.ThrowIfCancellationRequested();
                    //start session ping loop
                    Task pingTask = StartPingLoop();
                    //run request
                    await RunQuery(String.Format("searching {0}", sr.SearchString), true, true);
                }
                catch (OperationCanceledException)
                {
                    throw;
                }
                finally
                {
                    Pici.Log.info(typeof(SearchSession), "running initial search finished");
                }
            }
        }
Exemple #2
0
 public void Start(List <Hit> hits, SearchRequest sr, SearchCallback <SearchStatus> statusCallback)
 {
     WaitUntilQueryFinishes(statusCallback.CancellationToken.Value);
     this.Callback = statusCallback;
     this.Request  = sr;
     FakeHits      = hits;
     Status        = new SearchStatus();
     if (QueryStarted != null)
     {
         QueryStarted(null);
     }
     Status = new SearchStatus()
     {
         progress = 1.0,
         hits     = hits.Count
     };
 }