public void Tokenize(SearchTokens tokens) { foreach (ICondition cond in this.Conditions) { cond.Tokenize(tokens); } }
private void ComboBoxDisplayFormat_SelectedIndexChanged(object sender, EventArgs e) { if (SearchTokens != null && SearchTokens.Any()) { SetDisplayResults(); } }
private void ComboBoxFiltering_SelectedIndexChanged(object sender, EventArgs e) { if (SearchTokens != null && SearchTokens.Any()) { SetDisplayResults(); ValidateButtons(); } }
private void SetDisplayResults() { string jsonContent; var selectedFilterIndex = (Filtering)comboBoxFiltering.SelectedIndex; var selectedDisplayIndex = comboBoxDisplayFormat.SelectedIndex; switch (selectedFilterIndex) { case Filtering.Pagination: jsonContent = SearchTokens[CurrentIndex].ToString(); SetDisplayResultSummary(); break; case Filtering.List: jsonContent = string.Join(Environment.NewLine, SearchTokens.Select(e => e.ToString())); SetDisplayResultSummary(); break; case Filtering.UniqueList: case Filtering.UniqueListWithCount: { var uniqueItems = SearchTokens.GroupBy(x => x.ToString()) .Select(g => new { Text = g.Key, Count = g.Count() }); var str = new StringBuilder(); foreach (var item in uniqueItems) { str.AppendLine(selectedFilterIndex == Filtering.UniqueList ? item.Text : $"{item.Text.PadRight(75, ' ')}- {item.Count}"); } jsonContent = str.ToString(); SetDisplayResultSummary(uniqueItems.Count()); break; } default: throw new ArgumentOutOfRangeException(); } if (selectedDisplayIndex == 0) { textBoxQueryResults.Show(); textBoxQueryResults.Text = jsonContent; } else { webBrowserResults.Show(); var builder = new StringBuilder(); builder.AppendLine(selectedDisplayIndex == 1 ? "~~~javascript" : "~~~json"); builder.AppendLine(jsonContent); builder.AppendLine("~~~"); webBrowserResults.DocumentText = Markdown.ToHtml(builder.ToString(), _syntaxPipeLine); } }
public void Tokenize(SearchTokens tokens) { this.TokenizedName = tokens.GetNameToken(this.Name); if (this.CaseSensitive == true) { this.TokenizedValue = tokens.GetValueToken(this.Value); } else { string regex = "(?i)" + this._regexprefix + Regex.Escape(this.Value) + this._regexsuffix; this.TokenizedValue = tokens.GetValueToken(regex); } }
/// <summary> /// Converts the node to T-SQL. /// </summary> /// <param name="searchTokens"><see cref="SearchTokens" /> instance to fetch tokens with.</param> /// <param name="insertClause">If true, insert the specified clause in TSQL.</param> /// <param name="clause">Sort column name or similarity clause to be inserted.</param> /// <param name="isSimilarityClause">If true, insert the specified similarity clause in TSQL else insert sort clause.</param> /// <returns>T-SQL equivalent of the node.</returns> public abstract string ConvertToTSql(SearchTokens searchTokens, bool insertClause, string clause, bool isSimilarityClause);
/// <summary> /// Converts the node to T-SQL. /// </summary> /// <param name="searchTokens"><see cref="SearchTokens" /> instance to fetch tokens with.</param> /// <returns>T-SQL equivalent of the node.</returns> public abstract string ConvertToTSql(SearchTokens searchTokens);
public void Tokenize(SearchTokens tokens) { this.TokenizedName = tokens.GetNameToken(this.Name); this.TokenizedValue = tokens.GetValueToken(this.Value); }