mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
#594 - ElasticSearch - Add support for TextSimple, TextQueryString and TextCommon full text search expressions
This commit is contained in:
1 parent
75a84af3f8
commit
049bf76cc4
17 files changed
+994
-48
No files matched your search
@@ -5,6 +5,9 @@ import com.avaje.ebean.TextExpressionList;
|
||||
import com.avaje.ebean.TextJunction;
|
||||
import com.avaje.ebean.search.Match;
|
||||
import com.avaje.ebean.search.MultiMatch;
|
||||
import com.avaje.ebean.search.TextCommonTerms;
|
||||
import com.avaje.ebean.search.TextQueryString;
|
||||
import com.avaje.ebean.search.TextSimple;
|
||||
import com.avaje.ebeaninternal.api.SpiExpression;
|
||||
import com.avaje.ebeaninternal.api.SpiTextJunction;
|
||||
|
||||
@@ -58,6 +61,21 @@ class DTextJunction<T> extends JunctionExpression<T> implements SpiTextJunction<
|
||||
return exprList.multiMatch(query, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextExpressionList<T> textSimple(String search, TextSimple options) {
|
||||
return exprList.textSimple(search, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextExpressionList<T> textQueryString(String search, TextQueryString options) {
|
||||
return exprList.textQueryString(search, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextExpressionList<T> textCommonTerms(String search, TextCommonTerms options) {
|
||||
return exprList.textCommonTerms(search, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextJunction<T> must() {
|
||||
return exprList.must();
|
||||
|
||||
@@ -12,6 +12,9 @@ import com.avaje.ebean.TextJunction;
|
||||
import com.avaje.ebean.bean.EntityBean;
|
||||
import com.avaje.ebean.search.Match;
|
||||
import com.avaje.ebean.search.MultiMatch;
|
||||
import com.avaje.ebean.search.TextCommonTerms;
|
||||
import com.avaje.ebean.search.TextQueryString;
|
||||
import com.avaje.ebean.search.TextSimple;
|
||||
import com.avaje.ebeaninternal.api.SpiExpressionFactory;
|
||||
import com.avaje.ebeaninternal.api.SpiQuery;
|
||||
|
||||
@@ -50,6 +53,21 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
|
||||
return new TextMultiMatchExpression(query, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expression textSimple(String search, TextSimple options) {
|
||||
return new TextSimpleExpression(search, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expression textQueryString(String search, TextQueryString options) {
|
||||
return new TextQueryStringExpression(search, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expression textCommonTerms(String search, TextCommonTerms options) {
|
||||
return new TextCommonTermsExpression(search, options);
|
||||
}
|
||||
|
||||
public Expression jsonExists(String propertyName, String path) {
|
||||
return new JsonPathExpression(propertyName, path, Op.EXISTS, null);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ import com.avaje.ebean.*;
|
||||
import com.avaje.ebean.event.BeanQueryRequest;
|
||||
import com.avaje.ebean.search.Match;
|
||||
import com.avaje.ebean.search.MultiMatch;
|
||||
import com.avaje.ebean.search.TextCommonTerms;
|
||||
import com.avaje.ebean.search.TextQueryString;
|
||||
import com.avaje.ebean.search.TextSimple;
|
||||
import com.avaje.ebeaninternal.api.HashQueryPlanBuilder;
|
||||
import com.avaje.ebeaninternal.api.ManyWhereJoins;
|
||||
import com.avaje.ebeaninternal.api.SpiExpression;
|
||||
@@ -876,6 +879,24 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T>, SpiTextEx
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextExpressionList<T> textSimple(String search, TextSimple options) {
|
||||
add(expr.textSimple(search, options));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextExpressionList<T> textQueryString(String search, TextQueryString options) {
|
||||
add(expr.textQueryString(search, options));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextExpressionList<T> textCommonTerms(String search, TextCommonTerms options) {
|
||||
add(expr.textCommonTerms(search, options));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextJunction<T> must() {
|
||||
return textJunction(TextJunction.Type.MUST);
|
||||
|
||||
@@ -4,6 +4,9 @@ import com.avaje.ebean.LikeType;
|
||||
import com.avaje.ebean.TextJunction;
|
||||
import com.avaje.ebean.search.Match;
|
||||
import com.avaje.ebean.search.MultiMatch;
|
||||
import com.avaje.ebean.search.TextCommonTerms;
|
||||
import com.avaje.ebean.search.TextQueryString;
|
||||
import com.avaje.ebean.search.TextSimple;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@@ -104,6 +107,21 @@ public interface DocQueryContext {
|
||||
*/
|
||||
void writeMultiMatch(String search, MultiMatch options) throws IOException;
|
||||
|
||||
/**
|
||||
* Write a simple expression.
|
||||
*/
|
||||
void writeTextSimple(String search, TextSimple options) throws IOException;
|
||||
|
||||
/**
|
||||
* Write a common terms expression.
|
||||
*/
|
||||
void writeTextCommonTerms(String search, TextCommonTerms options) throws IOException;
|
||||
|
||||
/**
|
||||
* Write a query string expression.
|
||||
*/
|
||||
void writeTextQueryString(String search, TextQueryString options) throws IOException;
|
||||
|
||||
/**
|
||||
* Start a Bool which may contain some of Must, Must Not, Should.
|
||||
*/
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.avaje.ebeaninternal.server.expression;
|
||||
|
||||
import com.avaje.ebean.search.TextCommonTerms;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Full text common terms expression.
|
||||
*/
|
||||
class TextCommonTermsExpression extends AbstractTextExpression {
|
||||
|
||||
private final String search;
|
||||
|
||||
private final TextCommonTerms options;
|
||||
|
||||
public TextCommonTermsExpression(String search, TextCommonTerms options) {
|
||||
super(null);
|
||||
this.search = search;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDocQuery(DocQueryContext context) throws IOException {
|
||||
context.writeTextCommonTerms(search, options);
|
||||
}
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.avaje.ebeaninternal.server.expression;
|
||||
|
||||
import com.avaje.ebean.search.TextQueryString;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Full text query string expression.
|
||||
*/
|
||||
class TextQueryStringExpression extends AbstractTextExpression {
|
||||
|
||||
private final String search;
|
||||
|
||||
private final TextQueryString options;
|
||||
|
||||
public TextQueryStringExpression(String search, TextQueryString options) {
|
||||
super(null);
|
||||
this.search = search;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDocQuery(DocQueryContext context) throws IOException {
|
||||
context.writeTextQueryString(search, options);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.avaje.ebeaninternal.server.expression;
|
||||
|
||||
import com.avaje.ebean.search.TextSimple;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Full text Multi-Match expression.
|
||||
*/
|
||||
class TextSimpleExpression extends AbstractTextExpression {
|
||||
|
||||
private final String search;
|
||||
|
||||
private final TextSimple options;
|
||||
|
||||
public TextSimpleExpression(String search, TextSimple options) {
|
||||
super(null);
|
||||
this.search = search;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDocQuery(DocQueryContext context) throws IOException {
|
||||
context.writeTextSimple(search, options);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user