protected virtual TermFilter GetTermFilter(Antlr.SearchPhraseParser.AttributeFilterContext context) { var fieldNameContext = context.GetChild <Antlr.SearchPhraseParser.FieldNameContext>(0); var attributeValueContext = context.GetChild <Antlr.SearchPhraseParser.AttributeFilterValueContext>(0); if (fieldNameContext == null || attributeValueContext == null) { return(null); } var values = attributeValueContext.children.OfType <Antlr.SearchPhraseParser.StringContext>().ToArray(); var filter = new TermFilter { FieldName = Unescape(fieldNameContext.GetText()), Values = values.Select(v => Unescape(v.GetText())).ToArray(), }; return(filter); }
public override void ExitAttributeFilter(Antlr.SearchPhraseParser.AttributeFilterContext context) { base.ExitAttributeFilter(context); var fieldNameContext = context.GetChild <Antlr.SearchPhraseParser.FieldNameContext>(0); var attributeValueContext = context.GetChild <Antlr.SearchPhraseParser.AttributeFilterValueContext>(0); if (fieldNameContext != null && attributeValueContext != null) { var values = attributeValueContext.children.OfType <Antlr.SearchPhraseParser.StringContext>().ToArray(); var filter = new TermFilter { FieldName = Unescape(fieldNameContext.GetText()), Values = values.Select(v => Unescape(v.GetText())).ToArray(), }; Filters.Add(filter); } }
/// <summary> /// Exit a parse tree produced by <see cref="SearchPhraseParser.attributeFilter"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitAttributeFilter([NotNull] SearchPhraseParser.AttributeFilterContext context) { }