コード例 #1
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="shushuConfiguration">Shushu configuration</param>
        public Shushu(IShushuConfiguration shushuConfiguration)
        {
            if (shushuConfiguration == null)
            {
                throw new System.ArgumentNullException(nameof(shushuConfiguration));
            }

            InitClients(shushuConfiguration);
        }
コード例 #2
0
        void InitClients(IShushuConfiguration shushuConfiguration)
        {
            _index         = shushuConfiguration.Index;
            _serviceClient = new SearchServiceClient(shushuConfiguration.Name, new SearchCredentials(shushuConfiguration.ServiceApiKey));
            _searchClient  = new SearchIndexClient(shushuConfiguration.Name, shushuConfiguration.Index, new SearchCredentials(shushuConfiguration.SearchApiKey));
            _indexClient   = new SearchIndexClient(shushuConfiguration.Name, shushuConfiguration.Index, new SearchCredentials(shushuConfiguration.ServiceApiKey));

            var idx = _serviceClient.Indexes.List().Indexes.FirstOrDefault(x => x.Name.Equals(shushuConfiguration.Index));

            if (idx == null)
            {
                CreateIndex();
            }
        }