#875 - Changes to support ElasticSearch 5.x

This commit is contained in:
Rob Bygrave
2016-11-11 23:43:13 +13:00
parent 2953418683
commit 482d454fc3
5 changed files with 21 additions and 40 deletions
@@ -96,6 +96,11 @@ public interface Junction<T> extends Expression, ExpressionList<T> {
*/
NOT(" and ", "not ", false),
/**
* FILTER group (for internal use only).
*/
FILTER("filter", "", true),
/**
* Text search AND group.
*/
@@ -38,7 +38,6 @@ package com.avaje.ebean.search;
public class TextQueryString {
public static final int DEFAULT_FUZZY_MAX_EXPANSIONS = 50;
public static final int DEFAULT_MAX_DETERMINIZED_STATES = 10000;
protected final String[] fields;
@@ -62,8 +61,6 @@ public class TextQueryString {
protected boolean lowercaseExpandedTerms = true;
protected boolean enablePositionIncrements = true;
protected int fuzzyMaxExpansions = DEFAULT_FUZZY_MAX_EXPANSIONS;
protected String fuzziness;
@@ -78,8 +75,6 @@ public class TextQueryString {
protected boolean autoGeneratePhraseQueries;
protected int maxDeterminizedStates = DEFAULT_MAX_DETERMINIZED_STATES;
protected String minShouldMatch;
protected boolean lenient;
@@ -192,14 +187,6 @@ public class TextQueryString {
return this;
}
/**
* Set enable position increments mode.
*/
public TextQueryString enablePositionIncrements(boolean enablePositionIncrements) {
this.enablePositionIncrements = enablePositionIncrements;
return this;
}
/**
* Set fuzzy max expansions.
*/
@@ -255,14 +242,6 @@ public class TextQueryString {
return this;
}
/**
* Set the max determinized states.
*/
public TextQueryString maxDeterminizedStates(int maxDeterminizedStates) {
this.maxDeterminizedStates = maxDeterminizedStates;
return this;
}
/**
* Set the time zone.
*/
@@ -363,13 +342,6 @@ public class TextQueryString {
return lowercaseExpandedTerms;
}
/**
* Return the enable position increments mode.
*/
public boolean isEnablePositionIncrements() {
return enablePositionIncrements;
}
/**
* Return the fuzzy max expansions.
*/
@@ -419,13 +391,6 @@ public class TextQueryString {
return autoGeneratePhraseQueries;
}
/**
* Return the max determinized states.
*/
public int getMaxDeterminizedStates() {
return maxDeterminizedStates;
}
/**
* Return the time zone.
*/
@@ -1,6 +1,7 @@
package com.avaje.ebeaninternal.api;
import com.avaje.ebean.ExpressionList;
import com.avaje.ebean.Junction;
import com.avaje.ebeaninternal.server.expression.DocQueryContext;
import java.io.IOException;
@@ -11,16 +12,21 @@ import java.util.List;
*/
public interface SpiExpressionList<T> extends ExpressionList<T>, SpiExpression {
/**
* Return the expression list as a Junction (for ElasticSearch).
*/
Junction<T> toJunction();
/**
* Return the underlying list of expressions.
*/
List<SpiExpression> getUnderlyingList();
/**
* Return a copy of the ExpressionList with the path trimmed for filterMany() expressions.
*/
SpiExpressionList<?> trimPath(int prefixTrim);
/**
* Return true if this list is empty.
*/
@@ -103,6 +103,11 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
}
}
@Override
public Junction<T> toJunction() {
return new JunctionExpression<>(Junction.Type.FILTER, this);
}
public void simplify() {
simplifyEntries();
}
@@ -77,7 +77,7 @@ public class OrmQueryProperties implements Serializable {
* Construct for root so path (and parentPath) are null.
*/
public OrmQueryProperties() {
this((String)null);
this((String) null);
}
/**
@@ -123,7 +123,7 @@ public class OrmQueryProperties implements Serializable {
this.parentPath = SplitName.parent(path);
// for rawSql parsedProperties can be empty (when only fetching Id property)
this.included = parsedProperties;
this.rawProperties = join(parsedProperties);
this.rawProperties = join(parsedProperties);
this.trimmedProperties = rawProperties;
this.cache = false;
this.readOnly = false;
@@ -263,7 +263,7 @@ public class OrmQueryProperties implements Serializable {
}
}
boolean hasSelectClause() {
public boolean hasSelectClause() {
if ("*".equals(trimmedProperties)) {
// explicitly selected all properties
return true;