com.stratio.cassandra.lucene.builder.search.condition.Condition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cassandra-lucene-index-builder Show documentation
Show all versions of cassandra-lucene-index-builder Show documentation
Cassandra Lucene Index builder
/*
* Copyright (C) 2014 Stratio (http://stratio.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.stratio.cassandra.lucene.builder.search.condition;
import com.stratio.cassandra.lucene.builder.Builder;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonSubTypes;
import org.codehaus.jackson.annotate.JsonTypeInfo;
/**
* The abstract base class for queries.
*
* Known subclasses are: - {@link AllCondition}
- {@link BitemporalCondition}
- {@link ContainsCondition}
*
- {@link FuzzyCondition}
- {@link MatchCondition}
- {@link PhraseCondition}
- {@link PrefixCondition}
*
- {@link RangeCondition}
- {@link WildcardCondition}
- {@link GeoDistanceCondition}
- {@link
* GeoBBoxCondition}
*
* @author Andres de la Pena {@literal }
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({@JsonSubTypes.Type(value = AllCondition.class, name = "all"),
@JsonSubTypes.Type(value = BitemporalCondition.class, name = "bitemporal"),
@JsonSubTypes.Type(value = BooleanCondition.class, name = "boolean"),
@JsonSubTypes.Type(value = ContainsCondition.class, name = "contains"),
@JsonSubTypes.Type(value = DateRangeCondition.class, name = "date_range"),
@JsonSubTypes.Type(value = FuzzyCondition.class, name = "fuzzy"),
@JsonSubTypes.Type(value = GeoDistanceCondition.class, name = "geo_distance"),
@JsonSubTypes.Type(value = GeoBBoxCondition.class, name = "geo_bbox"),
@JsonSubTypes.Type(value = GeoShapeCondition.class, name = "geo_shape"),
@JsonSubTypes.Type(value = LuceneCondition.class, name = "lucene"),
@JsonSubTypes.Type(value = MatchCondition.class, name = "match"),
@JsonSubTypes.Type(value = NoneCondition.class, name = "none"),
@JsonSubTypes.Type(value = PhraseCondition.class, name = "phrase"),
@JsonSubTypes.Type(value = PrefixCondition.class, name = "prefix"),
@JsonSubTypes.Type(value = RangeCondition.class, name = "range"),
@JsonSubTypes.Type(value = RegexpCondition.class, name = "regexp"),
@JsonSubTypes.Type(value = WildcardCondition.class, name = "wildcard")})
public abstract class Condition extends Builder {
/** The boost for the {@code Condition} to be built. */
@JsonProperty("boost")
Float boost;
/**
* Sets the boost for the {@code Condition} to be built. Documents matching this condition will (in addition to the
* normal weightings) have their score multiplied by {@code boost}. Defaults to {@code 1.0}.
*
* @param boost the boost for the {@code Condition} to be built
* @return this with the specified boost
*/
@SuppressWarnings("unchecked")
public T boost(float boost) {
this.boost = boost;
return (T) this;
}
/**
* Sets the boost for the {@code Condition} to be built. Documents matching this condition will (in addition to the
* normal weightings) have their score multiplied by {@code boost}. Defaults to {@code 1.0}.
*
* @param boost the boost for the {@code Condition} to be built
* @return this with the specified boost
*/
@SuppressWarnings("unchecked")
public T boost(Number boost) {
this.boost = boost == null ? null : boost.floatValue();
return (T) this;
}
}