Skip to content

Added Tokenizer and Filters querystring param to Analyze request #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Nest/Domain/Parameters/AnalyzeParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class AnalyzeParams
{
public string Index { get; set; }
public string Field { get; set; }
public string Analyzer { get; set; }
public string Analyzer { get; set; }
public string Filters { get; set; }
public string Tokenizer { get; set; }
}
}
14 changes: 11 additions & 3 deletions src/Nest/ElasticClient-Analyze.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,17 @@ private AnalyzeResponse _Analyze(AnalyzeParams analyzeParams, string text)
path += Uri.EscapeDataString(text);

if (!analyzeParams.Field.IsNullOrEmpty())
path += "&field=" + analyzeParams.Field;
else if (!analyzeParams.Analyzer.IsNullOrEmpty())
path += "&analyzer=" + analyzeParams.Analyzer;
path += "&field=" + analyzeParams.Field;
else if (!analyzeParams.Analyzer.IsNullOrEmpty())
path += "&analyzer=" + analyzeParams.Analyzer;
else
{
//Build custom analyzer out of tokenizers and filters
if (!analyzeParams.Filters.IsNullOrEmpty())
path += "&filters=" + analyzeParams.Filters;
if (!analyzeParams.Tokenizer.IsNullOrEmpty())
path += "&tokenizer=" + analyzeParams.Tokenizer;
}

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