Class Queries


  • public class Queries
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Queries()  
    • Method Summary

      Modifier and Type Method Description
      static org.apache.lucene.search.Query applyMinimumShouldMatch​(org.apache.lucene.search.BooleanQuery query, java.lang.String minimumShouldMatch)  
      static int calculateMinShouldMatch​(int optionalClauseCount, java.lang.String spec)  
      static org.apache.lucene.search.BooleanQuery filtered​(org.apache.lucene.search.Query query, org.apache.lucene.search.Query filter)  
      static org.apache.lucene.search.Query fixNegativeQueryIfNeeded​(org.apache.lucene.search.Query q)  
      static org.apache.lucene.search.Query maybeApplyMinimumShouldMatch​(org.apache.lucene.search.Query query, java.lang.String minimumShouldMatch)
      Potentially apply minimum should match value if we have a query that it can be applied to, otherwise return the original query.
      static org.apache.lucene.search.Query newLenientFieldQuery​(java.lang.String field, java.lang.RuntimeException e)  
      static org.apache.lucene.search.Query newMatchAllQuery()  
      static org.apache.lucene.search.Query newMatchNoDocsQuery​(java.lang.String reason)
      Return a query that matches no document.
      static org.apache.lucene.search.Query newNestedFilter()  
      static org.apache.lucene.search.Query newNonNestedFilter​(Version indexVersionCreated)
      Creates a new non-nested docs query
      static org.apache.lucene.search.Query newUnmappedFieldQuery​(java.lang.String field)  
      static org.apache.lucene.search.Query newUnmappedFieldsQuery​(java.util.Collection<java.lang.String> fields)  
      static org.apache.lucene.search.Query not​(org.apache.lucene.search.Query q)
      Return a query that matches all documents but those that match the given query.
      • Methods inherited from class java.lang.Object

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

      • Queries

        public Queries()
    • Method Detail

      • newMatchAllQuery

        public static org.apache.lucene.search.Query newMatchAllQuery()
      • newMatchNoDocsQuery

        public static org.apache.lucene.search.Query newMatchNoDocsQuery​(java.lang.String reason)
        Return a query that matches no document.
      • newUnmappedFieldQuery

        public static org.apache.lucene.search.Query newUnmappedFieldQuery​(java.lang.String field)
      • newUnmappedFieldsQuery

        public static org.apache.lucene.search.Query newUnmappedFieldsQuery​(java.util.Collection<java.lang.String> fields)
      • newLenientFieldQuery

        public static org.apache.lucene.search.Query newLenientFieldQuery​(java.lang.String field,
                                                                          java.lang.RuntimeException e)
      • newNestedFilter

        public static org.apache.lucene.search.Query newNestedFilter()
      • newNonNestedFilter

        public static org.apache.lucene.search.Query newNonNestedFilter​(Version indexVersionCreated)
        Creates a new non-nested docs query
        Parameters:
        indexVersionCreated - the index version created since newer indices can identify a parent field more efficiently
      • filtered

        public static org.apache.lucene.search.BooleanQuery filtered​(@Nullable
                                                                     org.apache.lucene.search.Query query,
                                                                     @Nullable
                                                                     org.apache.lucene.search.Query filter)
      • not

        public static org.apache.lucene.search.Query not​(org.apache.lucene.search.Query q)
        Return a query that matches all documents but those that match the given query.
      • fixNegativeQueryIfNeeded

        public static org.apache.lucene.search.Query fixNegativeQueryIfNeeded​(org.apache.lucene.search.Query q)
      • applyMinimumShouldMatch

        public static org.apache.lucene.search.Query applyMinimumShouldMatch​(org.apache.lucene.search.BooleanQuery query,
                                                                             @Nullable
                                                                             java.lang.String minimumShouldMatch)
      • maybeApplyMinimumShouldMatch

        public static org.apache.lucene.search.Query maybeApplyMinimumShouldMatch​(org.apache.lucene.search.Query query,
                                                                                  @Nullable
                                                                                  java.lang.String minimumShouldMatch)
        Potentially apply minimum should match value if we have a query that it can be applied to, otherwise return the original query.
      • calculateMinShouldMatch

        public static int calculateMinShouldMatch​(int optionalClauseCount,
                                                  java.lang.String spec)