Class FieldQuery

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class FieldQuery
    extends Query
    Models a query qualified with a field.
    Author:
    Vassilis Plachouras, Craig Macdonald
    See Also:
    Serialized Form
    • Field Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      FieldQuery()
      An empty default constructor
      FieldQuery​(Query q)
      Constructs a field query from the given query.
      FieldQuery​(Query q, java.lang.String f)
      Constructs a field query from the given query and the given field.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Deep Clone this object
      java.lang.String getField()
      Gets the field that the query term should appear.
      void getTermsOf​(java.lang.Class<? extends Query> c, java.util.List<Query> alist, boolean req)
      Returns all the query terms, in subqueries that are instances of a given class
      boolean obtainControls​(java.util.Set<java.lang.String> allowed, java.util.Map<java.lang.String,​java.lang.String> controls)
      Checks to see if field name is a valid control name, as specified by allowed, and if so adds it to the controls table and returns true to specify that this Query object is now dead.
      void obtainQueryTerms​(MatchingQueryTerms terms, java.lang.String field, java.lang.Boolean required, java.lang.Double weight)  
      void obtainQueryTerms​(Query.QueryTermsParameter parameters)  
      java.lang.String parseTree()
      Returns the parse tree for the query as a string
      void setField​(java.lang.String f)
      Sets the value of the field.
      java.lang.String toString()
      Returns a string representation of the query.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FieldQuery

        public FieldQuery()
        An empty default constructor
      • FieldQuery

        public FieldQuery​(Query q)
        Constructs a field query from the given query.
        Parameters:
        q - the query that is qualified with the field operator.
      • FieldQuery

        public FieldQuery​(Query q,
                          java.lang.String f)
        Constructs a field query from the given query and the given field.
        Parameters:
        q - Query the query that is qualified with the field operator.
        f - String the field in which the given query should appear in.
    • Method Detail

      • clone

        public java.lang.Object clone()
        Deep Clone this object
        Overrides:
        clone in class Query
      • getField

        public java.lang.String getField()
        Gets the field that the query term should appear.
        Returns:
        String the field that the query term should appear.
      • setField

        public void setField​(java.lang.String f)
        Sets the value of the field.
        Parameters:
        f - String the value of the field.
      • toString

        public java.lang.String toString()
        Returns a string representation of the query.
        Specified by:
        toString in class Query
        Returns:
        String the string of the query.
      • obtainQueryTerms

        public void obtainQueryTerms​(MatchingQueryTerms terms,
                                     java.lang.String field,
                                     java.lang.Boolean required,
                                     java.lang.Double weight)
        Specified by:
        obtainQueryTerms in class Query
      • obtainControls

        public boolean obtainControls​(java.util.Set<java.lang.String> allowed,
                                      java.util.Map<java.lang.String,​java.lang.String> controls)
        Checks to see if field name is a valid control name, as specified by allowed, and if so adds it to the controls table and returns true to specify that this Query object is now dead.
        Overrides:
        obtainControls in class Query
        Parameters:
        allowed - A hashset of lowercase control names that may be set by user queries.
        controls - The hashtable to add the found controls to
        Returns:
        true if this node should now be removed, false otherwise
      • getTermsOf

        public void getTermsOf​(java.lang.Class<? extends Query> c,
                               java.util.List<Query> alist,
                               boolean req)
        Returns all the query terms, in subqueries that are instances of a given class
        Specified by:
        getTermsOf in class Query
        Parameters:
        c - Class a class of queries.
        alist - ArrayList the list of query terms.
        req - boolean indicates whether the subqueries are required or not.
      • parseTree

        public java.lang.String parseTree()
        Description copied from class: Query
        Returns the parse tree for the query as a string
        Specified by:
        parseTree in class Query