Exemple #1
0
        public void SetIndexingInfo(IDictionary <string, IndexFieldAnalyzer> analyzerTypes, IDictionary <string, IndexValueType> indexFieldTypes, IDictionary <string, string> sortFieldNames)
        {
            try
            {
                var request = new SetIndexingInfoRequest();

                foreach (var(key, indexFieldAnalyzer) in analyzerTypes)
                {
                    request.AnalyzerTypes.Add(key, (GrpcService.IndexFieldAnalyzer)indexFieldAnalyzer);
                }
                foreach (var(key, indexValueType) in indexFieldTypes)
                {
                    request.IndexFieldTypes.Add(key, (GrpcService.IndexValueType)indexValueType);
                }
                foreach (var(key, fieldName) in sortFieldNames)
                {
                    request.SortFieldNames.Add(key, fieldName);
                }

                _searchClient.SetIndexingInfo(request);
            }
            catch (Exception ex)
            {
                throw LogAndFormatException(ex, "SetIndexingInfo");
            }
        }
        public override Task <SetIndexingInfoResponse> SetIndexingInfo(SetIndexingInfoRequest request, ServerCallContext context)
        {
            _indexService.SetIndexingInfo(
                request.AnalyzerTypes.ToDictionary(kv => kv.Key, kv => (Indexing.IndexFieldAnalyzer)(int) kv.Value),
                request.IndexFieldTypes.ToDictionary(kv => kv.Key, kv => (Search.IndexValueType)(int) kv.Value),
                request.SortFieldNames.ToDictionary(kv => kv.Key, kv => kv.Value));

            return(Task.FromResult(new SetIndexingInfoResponse()));
        }