summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/Select.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/Select.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/Select.java27
1 files changed, 18 insertions, 9 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/Select.java b/container-search/src/main/java/com/yahoo/search/query/Select.java
index 3ffc6bddb24..ef6a7fe8272 100644
--- a/container-search/src/main/java/com/yahoo/search/query/Select.java
+++ b/container-search/src/main/java/com/yahoo/search/query/Select.java
@@ -10,6 +10,9 @@ import com.yahoo.search.query.profile.types.FieldDescription;
import com.yahoo.search.query.profile.types.QueryProfileType;
import com.yahoo.search.yql.VespaGroupingStep;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
/**
@@ -27,11 +30,11 @@ public class Select implements Cloneable {
public static final String WHERE = "where";
public static final String GROUPING = "grouping";
-
private static Model model;
private Query parent;
private String where = "";
private String grouping = "";
+ private List<GroupingRequest> groupingRequests = new ArrayList<>();
static {
argumentType = new QueryProfileType(SELECT);
@@ -67,8 +70,10 @@ public class Select implements Cloneable {
}
- /** Set the where-clause for the query. Must be a JSON-string, with the format described in the Select Reference doc - https://docs.vespa.ai/documentation/reference/select-reference.html. */
- public void setWhere(String where) {
+ /** Set the where-clause for the query. Must be a JSON-string, with the format described in the Select Reference doc:
+ * @see <a href="https://docs.vespa.ai/documentation/reference/select-reference.html">https://docs.vespa.ai/documentation/reference/select-reference.html</a>
+ */
+ public void setWhereString(String where) {
this.where = where;
model.setType(SELECT);
@@ -78,13 +83,13 @@ public class Select implements Cloneable {
/** Returns the where-clause in the query */
- public String getWhereString(){
- return this.where;
- }
+ public String getWhereString(){ return where; }
- /** Set the grouping-string for the query. Must be a JSON-string, with the format described in the Select Reference doc - https://docs.vespa.ai/documentation/reference/select-reference.html. */
- public void setGrouping(String grouping){
+ /** Set the grouping-string for the query. Must be a JSON-string, with the format described in the Select Reference doc:
+ * @see <a href="https://docs.vespa.ai/documentation/reference/select-reference.html">https://docs.vespa.ai/documentation/reference/select-reference.html</a>
+ * */
+ public void setGroupingString(String grouping){
this.grouping = grouping;
SelectParser parser = (SelectParser) ParserFactory.newInstance(Query.Type.SELECT, new ParserEnvironment());
@@ -98,10 +103,14 @@ public class Select implements Cloneable {
/** Returns the grouping in the query */
public String getGroupingString(){
- return this.grouping;
+ return grouping;
}
+ /** Returns the query's {@link GroupingRequest} objects, as mutable list */
+ public List<GroupingRequest> getGrouping(){ return groupingRequests; }
+
+
@Override
public String toString() {
return "where: [" + where + "], grouping: [" + grouping+ "]";