/// <summary>
        /// Initializes the search user and topics
        /// </summary>
        /// <param name="searchInstanceType">type of search instance</param>
        /// <returns>empty</returns>
        private async Task Init(SearchInstanceType searchInstanceType)
        {
            // Guard that ensures Init is executed once only
            lock (this.locker)
            {
                if (this.initStarted == true)
                {
                    return;
                }

                this.initStarted = true;
            }

            // get the connection strings
            string searchServiceName = await this.connectionStringProvider.GetSearchServiceName(searchInstanceType);

            string searchServiceAdminKey = await this.connectionStringProvider.GetSearchServiceAdminKey(searchInstanceType);

            // instantiate the two search interfaces
            this.searchUsers  = new SearchUsers(this.log, searchServiceName, searchServiceAdminKey);
            this.searchTopics = new SearchTopics(this.log, searchServiceName, searchServiceAdminKey);

            // Init done
            this.initDone.Set();
        }
        private void SearchTopicsMethod()
        {
            if (String.IsNullOrEmpty(TopicsKeyword) && SearchTopics != null)
            {
                SearchTopics.Clear();
            }

            SearchTopics = new IncrementalLoading <Topic>(GetMoreTopics, "search?t=topic&q={0}", FirstOffset,
                                                          false);
        }
Beispiel #3
0
        /// <summary>
        /// Delete the search indices
        /// </summary>
        /// <param name="searchServiceName">name of the search service</param>
        /// <param name="searchServiceAdminKey">admin access key</param>
        /// <returns>delete search task</returns>
        private static async Task DeleteSearch(string searchServiceName, string searchServiceAdminKey)
        {
            Console.WriteLine("Deleting search indices...");

            // instantiate the two search interfaces
            SearchUsers  searchUsers  = new SearchUsers(log, searchServiceName, searchServiceAdminKey);
            SearchTopics searchTopics = new SearchTopics(log, searchServiceName, searchServiceAdminKey);
            await searchTopics.DeleteIndex();

            Console.WriteLine("  Topic search index - Deleted");
            await searchUsers.DeleteIndex();

            Console.WriteLine("  User search index - Deleted");
        }
Beispiel #4
0
        /// <summary>
        /// Create the two search indices
        /// </summary>
        /// <param name="searchServiceName">name of the search service</param>
        /// <param name="searchServiceAdminKey">admin access key</param>
        /// <returns>provision search task</returns>
        private static async Task ProvisionSearch(string searchServiceName, string searchServiceAdminKey)
        {
            Console.WriteLine("Creating search indices...");

            // instantiate the two search interfaces
            SearchUsers  searchUsers  = new SearchUsers(log, searchServiceName, searchServiceAdminKey);
            SearchTopics searchTopics = new SearchTopics(log, searchServiceName, searchServiceAdminKey);

            // create the two indices
            await searchUsers.CreateIndex();

            Console.WriteLine("  User search index - Provisioned");
            await searchTopics.CreateIndex();

            Console.WriteLine("  Topic search index - Provisioned");
        }