Class FixedBooleanQuery

java.lang.Object
org.apache.lucene.search.Query
org.graylog.plugins.views.search.validation.FixedBooleanQuery
All Implemented Interfaces:
Iterable<org.apache.lucene.search.BooleanClause>

public class FixedBooleanQuery extends org.apache.lucene.search.Query implements Iterable<org.apache.lucene.search.BooleanClause>
The default BooleanQuery from lucene uses Multiset implementations in the visit method. These lose the reference to the actual query instance and aggregate queries if they are the same. This breaks our terms detection in validation. So we have to provide this alternative class that iterates bool clauses with correct references
  • Constructor Summary

    Constructors
    Constructor
    Description
    FixedBooleanQuery(org.apache.lucene.search.BooleanQuery delegate)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    void
    forEach(Consumer<? super org.apache.lucene.search.BooleanClause> consumer)
     
    int
     
    Iterator<org.apache.lucene.search.BooleanClause>
     
    Spliterator<org.apache.lucene.search.BooleanClause>
     
     
    void
    visit(org.apache.lucene.search.QueryVisitor visitor)
    This is the only purpose of this class - provide a simpler visit method that preserves the query reference to the underlying object.

    Methods inherited from class org.apache.lucene.search.Query

    classHash, createWeight, rewrite, sameClassAs, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FixedBooleanQuery

      public FixedBooleanQuery(org.apache.lucene.search.BooleanQuery delegate)
  • Method Details

    • toString

      public String toString(String field)
      Specified by:
      toString in class org.apache.lucene.search.Query
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in class org.apache.lucene.search.Query
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class org.apache.lucene.search.Query
    • iterator

      public Iterator<org.apache.lucene.search.BooleanClause> iterator()
      Specified by:
      iterator in interface Iterable<org.apache.lucene.search.BooleanClause>
    • forEach

      public void forEach(Consumer<? super org.apache.lucene.search.BooleanClause> consumer)
      Specified by:
      forEach in interface Iterable<org.apache.lucene.search.BooleanClause>
    • spliterator

      public Spliterator<org.apache.lucene.search.BooleanClause> spliterator()
      Specified by:
      spliterator in interface Iterable<org.apache.lucene.search.BooleanClause>
    • visit

      public void visit(org.apache.lucene.search.QueryVisitor visitor)
      This is the only purpose of this class - provide a simpler visit method that preserves the query reference to the underlying object. That reference is then used to obtain related query terms during validation.
      Specified by:
      visit in class org.apache.lucene.search.Query