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);
            }
        }
예제 #2
0
 /// <summary>
 /// Enter 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 EnterAttributeFilter([NotNull] SearchPhraseParser.AttributeFilterContext context)
 {
 }