예제 #1
0
 public void SimplAnalyzeDifferentIndexAndField()
 {
     //analyze text using a different index and custom analyzer
     var text = "this is a string with some spaces and stuff";
     var analyzer = new AnalyzeParams { Field = "content", Index = Test.Default.DefaultIndex + "_clone" };
     var r = this.ConnectedClient.Analyze(analyzer, text);
     this._defaultAnalyzeAssertations(r);
     Assert.False(r.Tokens.Count() == text.Split(new[] { ' ' }).Count());
 }
예제 #2
0
        public AnalyzeResponse Analyze <T>(Expression <Func <T, object> > selector, string index, string text) where T : class
        {
            selector.ThrowIfNull("selector");
            var fieldName     = this.PropertyNameResolver.Resolve(selector);
            var analyzeParams = new AnalyzeParams()
            {
                Index = index, Field = fieldName
            };

            return(this._Analyze(analyzeParams, text));
        }
예제 #3
0
        private AnalyzeResponse _Analyze(AnalyzeParams analyzeParams, string text)
        {
            var path = this.CreatePath(analyzeParams.Index) + "_analyze?text=";

            path += Uri.EscapeDataString(text);

            if (!analyzeParams.Field.IsNullOrEmpty())
            {
                path += "&field=" + analyzeParams.Field;
            }
            else if (!analyzeParams.Analyzer.IsNullOrEmpty())
            {
                path += "&analyzer=" + analyzeParams.Analyzer;
            }

            var status = this.Connection.GetSync(path);
            var r      = this.ToParsedResponse <AnalyzeResponse>(status);

            return(r);
        }
예제 #4
0
 public AnalyzeResponse Analyze(AnalyzeParams analyzeParams, string text)
 {
     analyzeParams.ThrowIfNull("analyzeParams");
     analyzeParams.Index.ThrowIfNull("analyzeParams.Index");
     return(this._Analyze(analyzeParams, text));
 }