public EventStackFilter() { var stackOnlyFields = _stackOnlyFields.Union(_stackOnlySpecialFields); var stackFields = stackOnlyFields.Union(_stackAndEventFields); _parser = new LuceneQueryParser(); _eventQueryVisitor = new ChainedQueryVisitor(); _eventQueryVisitor.AddVisitor(new RemoveFieldsQueryVisitor(stackOnlyFields)); _eventQueryVisitor.AddVisitor(new CleanupQueryVisitor()); _stackQueryVisitor = new ChainedQueryVisitor(); // remove everything not in the stack fields list _stackQueryVisitor.AddVisitor(new RemoveFieldsQueryVisitor(f => !stackFields.Contains(f))); _stackQueryVisitor.AddVisitor(new CleanupQueryVisitor()); // handles stack special fields and changing event field names to their stack equivalent _stackQueryVisitor.AddVisitor(new StackFilterQueryVisitor()); _stackQueryVisitor.AddVisitor(new CleanupQueryVisitor()); _invertedStackQueryVisitor = new ChainedQueryVisitor(); // remove everything not in the stack fields list _invertedStackQueryVisitor.AddVisitor(new RemoveFieldsQueryVisitor(f => !stackFields.Contains(f))); _invertedStackQueryVisitor.AddVisitor(new CleanupQueryVisitor()); // handles stack special fields and changing event field names to their stack equivalent _invertedStackQueryVisitor.AddVisitor(new StackFilterQueryVisitor()); _invertedStackQueryVisitor.AddVisitor(new CleanupQueryVisitor()); // inverts the filter _invertedStackQueryVisitor.AddVisitor(new InvertQueryVisitor(_stackNonInvertedFields)); _invertedStackQueryVisitor.AddVisitor(new CleanupQueryVisitor()); }
public ElasticQueryParserConfiguration AddVisitor(IChainableQueryVisitor visitor, int priority = 0) { QueryVisitor.AddVisitor(visitor, priority); AggregationVisitor.AddVisitor(visitor, priority); SortVisitor.AddVisitor(visitor, priority); return(this); }
public ElasticQueryParserConfiguration UseAliases(AliasResolver defaultAliasResolver, int priority = 50) { DefaultAliasResolver = defaultAliasResolver; var visitor = new AliasedQueryVisitor(); QueryVisitor.AddVisitor(visitor, priority); SortVisitor.AddVisitor(visitor, priority); AggregationVisitor.AddVisitor(new AliasedQueryVisitor(false), priority); return(this); }