public abstract void SearchStartSession(List <string> searchProviders, string query, SearchResultSetDelegate searchStartSessionComplete);
 public abstract void SearchResultSetLoad(SearchDescription searchDescription, SearchResultSetDelegate searchResultSetLoadComplete);
示例#3
0
        public override void SearchStartSession(List <string> searchProviders, string query, SearchResultSetDelegate searchStartSessionComplete)
        {
            _searchClusterTask = new SearchClusterTask();

            ThreadPool.QueueUserWorkItem(delegate(object state)
            {
                SearchResultSet searchResultSet                   = new SearchResultSet();
                searchResultSet.SearchDescription                 = new SearchDescription();
                searchResultSet.SearchDescription.Id              = Guid.NewGuid();
                searchResultSet.SearchDescription.Query           = query;
                searchResultSet.SearchDescription.QueryDate       = DateTime.Now.ToUniversalTime();
                searchResultSet.SearchDescription.SearchProviders = searchProviders;

                searchResultSet.SearchAggregateResults = _searchClusterTask.Search(searchProviders, query, _numItemsToRetrieve, CultureHelper.CurrentCulture);

                if (searchResultSet.SearchAggregateResults.Count > 0)
                {
                    if (!_searchClusterTask.Aborted)
                    {
                        searchResultSet.SearchClusters = _searchClusterTask.Cluster(query, CultureHelper.CurrentCulture);
                    }

                    if (!_searchClusterTask.Aborted)
                    {
                        try
                        {
                            byte[] packedData = Obany.Language.Xml.XmlHelper.BinarySerialize(searchResultSet);

                            SearchResultSetSaveLocal(searchResultSet.SearchDescription, packedData, true);
                        }
                        catch
                        {
                        }
                    }
                }
                else
                {
                    _searchClusterTask.Aborted = true;
                }

                if (searchStartSessionComplete != null)
                {
                    searchStartSessionComplete(_searchClusterTask.Aborted ? null : searchResultSet);
                }

                _searchClusterTask = null;
            }
                                         );
        }
示例#4
0
        public override void SearchResultSetLoad(SearchDescription searchDescription, SearchResultSetDelegate searchResultSetLoadComplete)
        {
            byte[] localSearchResultSetData = SearchResultSetLoadLocal(searchDescription.Id);

            if (localSearchResultSetData != null)
            {
                SearchResultSet searchResultSet = null;

                try
                {
                    searchResultSet = Obany.Language.Xml.XmlHelper.BinaryDeserialize <SearchResultSet>(localSearchResultSetData);
                }
                catch
                {
                }

                if (searchResultSetLoadComplete != null)
                {
                    searchResultSetLoadComplete(searchResultSet);
                }
            }
        }
        public override void SearchStartSession(List<string> searchProviders, string query, SearchResultSetDelegate searchStartSessionComplete)
        {
            _searchClusterTask = new SearchClusterTask();

            ThreadPool.QueueUserWorkItem(delegate(object state)
                {
                    SearchResultSet searchResultSet = new SearchResultSet();
                    searchResultSet.SearchDescription = new SearchDescription();
                    searchResultSet.SearchDescription.Id = Guid.NewGuid();
                    searchResultSet.SearchDescription.Query = query;
                    searchResultSet.SearchDescription.QueryDate = DateTime.Now.ToUniversalTime();
                    searchResultSet.SearchDescription.SearchProviders = searchProviders;

                    searchResultSet.SearchAggregateResults = _searchClusterTask.Search(searchProviders, query, _numItemsToRetrieve, CultureHelper.CurrentCulture);

                    if (searchResultSet.SearchAggregateResults.Count > 0)
                    {
                        if (!_searchClusterTask.Aborted)
                        {
                            searchResultSet.SearchClusters = _searchClusterTask.Cluster(query, CultureHelper.CurrentCulture);
                        }

                        if (!_searchClusterTask.Aborted)
                        {
                            try
                            {
                                byte[] packedData = Obany.Language.Xml.XmlHelper.BinarySerialize(searchResultSet);

                                SearchResultSetSaveLocal(searchResultSet.SearchDescription, packedData, true);
                            }
                            catch
                            {
                            }
                        }
                    }
                    else
                    {
                        _searchClusterTask.Aborted = true;
                    }

                    if (searchStartSessionComplete != null)
                    {
                        searchStartSessionComplete(_searchClusterTask.Aborted ? null : searchResultSet);
                    }

                    _searchClusterTask = null;
                }
            );
        }
        public override void SearchResultSetLoad(SearchDescription searchDescription, SearchResultSetDelegate searchResultSetLoadComplete)
        {
            byte[] localSearchResultSetData = SearchResultSetLoadLocal(searchDescription.Id);

            if (localSearchResultSetData != null)
            {
                SearchResultSet searchResultSet = null;

                try
                {
                    searchResultSet = Obany.Language.Xml.XmlHelper.BinaryDeserialize<SearchResultSet>(localSearchResultSetData);
                }
                catch
                {
                }

                if (searchResultSetLoadComplete != null)
                {
                    searchResultSetLoadComplete(searchResultSet);
                }
            }
        }