net.conquiris.lucene.search
Class Filters

java.lang.Object
  extended by net.derquinse.common.base.NotInstantiable
      extended by net.conquiris.lucene.search.Filters

public final class Filters
extends NotInstantiable

Filter building support class.

Author:
Andres Rodriguez

Method Summary
static BooleanFilter addClauses(BooleanFilter filter, BooleanClause.Occur occur, Filter... filters)
          Adds clauses to a boolean filter.
static BooleanFilter addClauses(BooleanFilter filter, BooleanClause.Occur occur, Iterable<? extends Filter> filters)
          Adds clauses to a boolean filter.
static BooleanFilter booleanFilter(BooleanClause.Occur occur, Filter... filters)
          Creates a boolean filter.
static BooleanFilter booleanFilter(BooleanClause.Occur occur, Iterable<? extends Filter> filters)
          Creates a boolean filter.
static NumericRangeFilter<Double> doubleRange(DoubleSchemaItem field, Double min, Double max, boolean minInclusive, boolean maxInclusive)
          Creates a new range filter.
static NumericRangeFilter<Double> doubleRange(DoubleSchemaItem field, Range<Double> range)
          Creates a new range filter.
static NumericRangeFilter<Double> doubleRange(String field, Double min, Double max, boolean minInclusive, boolean maxInclusive)
          Creates a new range filter.
static NumericRangeFilter<Double> doubleRange(String field, Range<Double> range)
          Creates a new range filter.
static NumericRangeFilter<Float> floatRange(FloatSchemaItem field, Float min, Float max, boolean minInclusive, boolean maxInclusive)
          Creates a new range filter.
static NumericRangeFilter<Float> floatRange(FloatSchemaItem field, Range<Float> range)
          Creates a new range filter.
static NumericRangeFilter<Float> floatRange(String field, Float min, Float max, boolean minInclusive, boolean maxInclusive)
          Creates a new range filter.
static NumericRangeFilter<Float> floatRange(String field, Range<Float> range)
          Creates a new range filter.
static NumericRangeFilter<Long> instantRange(InstantSchemaItem field, Range<? extends ReadableInstant> range)
          Creates a new range filter.
static NumericRangeFilter<Long> instantRange(InstantSchemaItem field, ReadableInstant min, ReadableInstant max, boolean minInclusive, boolean maxInclusive)
          Creates a new range filter.
static NumericRangeFilter<Long> instantRange(String field, Range<? extends ReadableInstant> range)
          Creates a new range filter.
static NumericRangeFilter<Long> instantRange(String field, ReadableInstant min, ReadableInstant max, boolean minInclusive, boolean maxInclusive)
          Creates a new range filter.
static NumericRangeFilter<Integer> intRange(IntegerSchemaItem field, Integer min, Integer max, boolean minInclusive, boolean maxInclusive)
          Creates a new range filter.
static NumericRangeFilter<Integer> intRange(IntegerSchemaItem field, Range<Integer> range)
          Creates a new range filter.
static NumericRangeFilter<Integer> intRange(String field, Integer min, Integer max, boolean minInclusive, boolean maxInclusive)
          Creates a new range filter.
static NumericRangeFilter<Integer> intRange(String field, Range<Integer> range)
          Creates a new range filter.
static NumericRangeFilter<Long> longRange(LongSchemaItem field, Long min, Long max, boolean minInclusive, boolean maxInclusive)
          Creates a new range filter.
static NumericRangeFilter<Long> longRange(LongSchemaItem field, Range<Long> range)
          Creates a new range filter.
static NumericRangeFilter<Long> longRange(String field, Long min, Long max, boolean minInclusive, boolean maxInclusive)
          Creates a new range filter.
static NumericRangeFilter<Long> longRange(String field, Range<Long> range)
          Creates a new range filter.
static Filter negate(Filter filter)
          Returns a filter that negates the provided one.
static TermRangeFilter termRange(String field, Range<String> range)
          Creates a new range filter.
static TermRangeFilter termRange(String field, Range<String> range, Collator collator)
          Creates a new range filter.
static TermRangeFilter termRange(String field, String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper)
          Creates a new range filter.
static TermRangeFilter termRange(String field, String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper, Collator collator)
          Creates a new range filter.
static TermRangeFilter termRange(TextSchemaItem field, Range<String> range)
          Creates a new range filter.
static TermRangeFilter termRange(TextSchemaItem field, Range<String> range, Collator collator)
          Creates a new range filter.
static TermRangeFilter termRange(TextSchemaItem field, String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper)
          Creates a new range filter.
static TermRangeFilter termRange(TextSchemaItem field, String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper, Collator collator)
          Creates a new range filter.
static
<T> TermsFilter
terms(Function<? super T,Term> termBuilder, Iterable<T> values)
          Constructs a filter for docs matching any of the terms added to it.
static
<T> TermsFilter
terms(Function<? super T,Term> termBuilder, T... values)
          Constructs a filter for docs matching any of the terms added to it.
static TermsFilter terms(Iterable<Term> terms)
          Constructs a filter for docs matching any of the terms added to it.
static TermsFilter terms(Term... terms)
          Constructs a filter for docs matching any of the terms added to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

negate

public static Filter negate(Filter filter)
Returns a filter that negates the provided one.


terms

public static TermsFilter terms(Iterable<Term> terms)
Constructs a filter for docs matching any of the terms added to it.


terms

public static TermsFilter terms(Term... terms)
Constructs a filter for docs matching any of the terms added to it.


terms

public static <T> TermsFilter terms(Function<? super T,Term> termBuilder,
                                    Iterable<T> values)
Constructs a filter for docs matching any of the terms added to it.


terms

public static <T> TermsFilter terms(Function<? super T,Term> termBuilder,
                                    T... values)
Constructs a filter for docs matching any of the terms added to it.


termRange

public static TermRangeFilter termRange(String field,
                                        @Nullable
                                        String lowerTerm,
                                        @Nullable
                                        String upperTerm,
                                        boolean includeLower,
                                        boolean includeUpper,
                                        Collator collator)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

termRange

public static TermRangeFilter termRange(String field,
                                        @Nullable
                                        String lowerTerm,
                                        @Nullable
                                        String upperTerm,
                                        boolean includeLower,
                                        boolean includeUpper)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

termRange

public static TermRangeFilter termRange(TextSchemaItem field,
                                        @Nullable
                                        String lowerTerm,
                                        @Nullable
                                        String upperTerm,
                                        boolean includeLower,
                                        boolean includeUpper,
                                        Collator collator)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

termRange

public static TermRangeFilter termRange(TextSchemaItem field,
                                        @Nullable
                                        String lowerTerm,
                                        @Nullable
                                        String upperTerm,
                                        boolean includeLower,
                                        boolean includeUpper)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

termRange

public static TermRangeFilter termRange(String field,
                                        Range<String> range,
                                        Collator collator)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

termRange

public static TermRangeFilter termRange(String field,
                                        Range<String> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

termRange

public static TermRangeFilter termRange(TextSchemaItem field,
                                        Range<String> range,
                                        Collator collator)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

termRange

public static TermRangeFilter termRange(TextSchemaItem field,
                                        Range<String> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

intRange

public static NumericRangeFilter<Integer> intRange(String field,
                                                   @Nullable
                                                   Integer min,
                                                   @Nullable
                                                   Integer max,
                                                   boolean minInclusive,
                                                   boolean maxInclusive)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

intRange

public static NumericRangeFilter<Integer> intRange(IntegerSchemaItem field,
                                                   @Nullable
                                                   Integer min,
                                                   @Nullable
                                                   Integer max,
                                                   boolean minInclusive,
                                                   boolean maxInclusive)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

intRange

public static NumericRangeFilter<Integer> intRange(String field,
                                                   Range<Integer> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

intRange

public static NumericRangeFilter<Integer> intRange(IntegerSchemaItem field,
                                                   Range<Integer> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

longRange

public static NumericRangeFilter<Long> longRange(String field,
                                                 @Nullable
                                                 Long min,
                                                 @Nullable
                                                 Long max,
                                                 boolean minInclusive,
                                                 boolean maxInclusive)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

longRange

public static NumericRangeFilter<Long> longRange(LongSchemaItem field,
                                                 @Nullable
                                                 Long min,
                                                 @Nullable
                                                 Long max,
                                                 boolean minInclusive,
                                                 boolean maxInclusive)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

longRange

public static NumericRangeFilter<Long> longRange(String field,
                                                 Range<Long> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

longRange

public static NumericRangeFilter<Long> longRange(LongSchemaItem field,
                                                 Range<Long> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

floatRange

public static NumericRangeFilter<Float> floatRange(String field,
                                                   @Nullable
                                                   Float min,
                                                   @Nullable
                                                   Float max,
                                                   boolean minInclusive,
                                                   boolean maxInclusive)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

floatRange

public static NumericRangeFilter<Float> floatRange(FloatSchemaItem field,
                                                   @Nullable
                                                   Float min,
                                                   @Nullable
                                                   Float max,
                                                   boolean minInclusive,
                                                   boolean maxInclusive)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

floatRange

public static NumericRangeFilter<Float> floatRange(String field,
                                                   Range<Float> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

floatRange

public static NumericRangeFilter<Float> floatRange(FloatSchemaItem field,
                                                   Range<Float> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

doubleRange

public static NumericRangeFilter<Double> doubleRange(String field,
                                                     @Nullable
                                                     Double min,
                                                     @Nullable
                                                     Double max,
                                                     boolean minInclusive,
                                                     boolean maxInclusive)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

doubleRange

public static NumericRangeFilter<Double> doubleRange(DoubleSchemaItem field,
                                                     @Nullable
                                                     Double min,
                                                     @Nullable
                                                     Double max,
                                                     boolean minInclusive,
                                                     boolean maxInclusive)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

doubleRange

public static NumericRangeFilter<Double> doubleRange(String field,
                                                     Range<Double> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

doubleRange

public static NumericRangeFilter<Double> doubleRange(DoubleSchemaItem field,
                                                     Range<Double> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

instantRange

public static NumericRangeFilter<Long> instantRange(String field,
                                                    @Nullable
                                                    ReadableInstant min,
                                                    @Nullable
                                                    ReadableInstant max,
                                                    boolean minInclusive,
                                                    boolean maxInclusive)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

instantRange

public static NumericRangeFilter<Long> instantRange(InstantSchemaItem field,
                                                    @Nullable
                                                    ReadableInstant min,
                                                    @Nullable
                                                    ReadableInstant max,
                                                    boolean minInclusive,
                                                    boolean maxInclusive)
Creates a new range filter.

Throws:
IllegalArgumentException - if both limits are null.

instantRange

public static NumericRangeFilter<Long> instantRange(String field,
                                                    Range<? extends ReadableInstant> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

instantRange

public static NumericRangeFilter<Long> instantRange(InstantSchemaItem field,
                                                    Range<? extends ReadableInstant> range)
Creates a new range filter.

Throws:
IllegalArgumentException - if the range has no bounds.

addClauses

public static BooleanFilter addClauses(BooleanFilter filter,
                                       BooleanClause.Occur occur,
                                       Iterable<? extends Filter> filters)
Adds clauses to a boolean filter.

Parameters:
filter - Boolean filter to which the clauses are added.
occur - Specifies how clauses are to occur in matching documents.
filters - Filters to use to build the clauses.
Returns:
The provided boolean filter.
Throws:
IllegalArgumentException - if the filters argument is empty.

addClauses

public static BooleanFilter addClauses(BooleanFilter filter,
                                       BooleanClause.Occur occur,
                                       Filter... filters)
Adds clauses to a boolean filter.

Parameters:
filter - Boolean filter to which the clauses are added.
occur - Specifies how clauses are to occur in matching documents.
filters - Filters to use to build the clauses.
Returns:
The provided boolean filter.
Throws:
IllegalArgumentException - if the filters argument is empty.

booleanFilter

public static BooleanFilter booleanFilter(BooleanClause.Occur occur,
                                          Iterable<? extends Filter> filters)
Creates a boolean filter.

Parameters:
occur - Specifies how clauses are to occur in matching documents.
filters - Filters to use to build the clauses.
Returns:
The boolean filter.
Throws:
IllegalArgumentException - if the filters argument is empty.

booleanFilter

public static BooleanFilter booleanFilter(BooleanClause.Occur occur,
                                          Filter... filters)
Creates a boolean filter.

Parameters:
occur - Specifies how clauses are to occur in matching documents.
filters - Filters to use to build the clauses.
Returns:
The boolean filter.
Throws:
IllegalArgumentException - if the filters argument is empty.


Copyright © 2013 Derquinse Projects. All Rights Reserved.