Class Criteria

java.lang.Object
dev.nicklasw.query.builder.Node
dev.nicklasw.query.builder.Criteria

public class Criteria extends Node
  • Field Details

  • Constructor Details

    • Criteria

      public Criteria(Field field)
  • Method Details

    • where

      public static Criteria where(@NonNull @NonNull String fieldName)
      Static factory method to create a new Criteria for field with given name.
      Parameters:
      fieldName - must not be null.
      Returns:
      the Criteria
    • where

      public static Criteria where(@NonNull @NonNull Field field)
      Static factory method to create a new Criteria for provided field.
      Parameters:
      field - must not be null.
      Returns:
      the Criteria
    • expression

      public Criteria expression(@NonNull @NonNull String s)
      Creates new Predicate allowing native solr expressions.
      Parameters:
      s - must not be null.
      Returns:
      the Criteria
    • is

      public Criteria is(@NonNull @NonNull Object o)
      Creates new Predicate without any wildcards. Strings with blanks will be escaped "string\ with\ blank"
      Parameters:
      o - must not be null
      Returns:
      the Criteria
    • between

      public Criteria between(@Nullable Object lowerBound, @Nullable Object upperBound)
      Creates new Predicate for RANGE [lowerBound TO upperBound].
      Parameters:
      lowerBound - can be null. A null value will be handled as a wildcard.
      upperBound - can be null. A null value will be handled as a wildcard.
      Returns:
      the Criteria
    • between

      public Criteria between(@Nullable Object lowerBound, @Nullable Object upperBound, boolean includeLowerBound, boolean includeUpperBound)
      Crates new Predicate for RANGE [lowerBound TO upperBound].
      Parameters:
      lowerBound - can be null. A null value will be handled as a wildcard.
      upperBound - can be null. A null value will be handled as a wildcard.
      includeLowerBound - to include the lower bound
      includeUpperBound - to include the upper bound
      Returns:
      the Criteria
    • fuzzy

      public Criteria fuzzy(String s)
      Creates new Predicate with trailing ~.
      Parameters:
      s - must not be null.
      Returns:
      the Criteria
    • fuzzy

      public Criteria fuzzy(@NonNull @NonNull String s, float levenshteinDistance)
      Creates new Predicate with trailing ~ followed by levensteinDistance.
      Parameters:
      s - must not be null.
      levenshteinDistance - must not be null.
      Returns:
      the Criteria
    • regexp

      public Criteria regexp(@NonNull @NonNull String s)
      Creates new Predicate allowing regular expression.
      Parameters:
      s - must not be null.
      Returns:
      the Criteria
    • boost

      public Criteria boost(float boost)
      Boost Criteria with given factor.
      Parameters:
      boost - the boost factor
      Returns:
      the Criteria
    • isNull

      public Criteria isNull()
      Creates new Predicate for null values.
      Returns:
      the Criteria
    • must

      public Criteria must()
      Set the Criteria as required.
      Returns:
      the Criteria
    • mustNot

      public Criteria mustNot()
      Set the Criteria as negating.
      Returns:
      the Criteria
    • getPredicates

      public Set<Predicate> getPredicates()
    • getField

      public Field getField()
    • getBoost

      public float getBoost()
      Boost factor value.
      Returns:
      Float.NaN if not set
    • create

      protected <T extends Node> T create()
      Specified by:
      create in class Node