public ResultJson(ResultCode code, string message = null) { this.api_version = "v1"; this.code = EnumExtension.GetEnumValue(typeof(ResultCode), code.ToString()); this.success = true; if (string.IsNullOrEmpty(message)) { this.message = EnumExtension.GetEnumDesc(typeof(ResultCode), code.ToString()); } if (code != ResultCode.OK) { this.success = false; } }
/// <summary> /// 分词 /// </summary> /// <param name="word">词</param> /// <returns></returns> public List <string> EsAnalyze(string word, Analyzer analyzer = Analyzer.standard) { var analyzeResponse = client.Indices.Analyze(a => a.Analyzer(EnumExtension.GetEnumDesc(analyzer)).Text(word)); return(analyzeResponse.Tokens.Select(zw => zw.Token).ToList()); }