Class Query

    • Constructor Detail

    • Method Detail

      • toString

        public abstract String toString(String field)
        Prints a query to a string, with field assumed to be the default field and omitted.
      • rewrite

        public Query rewrite(IndexReader reader)
                      throws IOException
        Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
      • equals

        public abstract boolean equals(Object obj)
        Override and implement query instance equivalence properly in a subclass. This is required so that QueryCache works properly. Typically a query will be equal to another only if it's an instance of the same class and its document-filtering properties are identical that other instance. Utility methods are provided for certain repetitive code.
        equals in class Object
        See Also:
        sameClassAs(Object), classHash()
      • sameClassAs

        protected final boolean sameClassAs(Object other)
        Utility method to check whether other is not null and is exactly of the same class as this object's class. When this method is used in an implementation of equals(Object), consider using classHash() in the implementation of hashCode() to differentiate different class
      • classHash

        protected final int classHash()
        Provides a constant integer for a given class, derived from the name of the class. The rationale for not using just Object.hashCode() is that classes may be assigned different hash codes for each execution and we want hashes to be possibly consistent to facilitate debugging.