aboutsummaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-11-20 10:52:18 +0100
committerJon Bratseth <bratseth@gmail.com>2022-11-20 10:52:18 +0100
commit50df4b41a631ff5186ad8b3edf0b8d02b6d79b80 (patch)
tree068a1e71e1e3f3182e6b63eac9a7af02b597e60e /client/src
parentc535f7e9b1e641d88a0460dc43a47562481770ce (diff)
Allow chaining directly to userinput
Diffstat (limited to 'client/src')
-rw-r--r--client/src/main/java/ai/vespa/client/dsl/Query.java1
-rw-r--r--client/src/main/java/ai/vespa/client/dsl/UserInput.java16
2 files changed, 10 insertions, 7 deletions
diff --git a/client/src/main/java/ai/vespa/client/dsl/Query.java b/client/src/main/java/ai/vespa/client/dsl/Query.java
index 36718ced814..118749b083c 100644
--- a/client/src/main/java/ai/vespa/client/dsl/Query.java
+++ b/client/src/main/java/ai/vespa/client/dsl/Query.java
@@ -13,7 +13,6 @@ public class Query extends QueryChain {
final List<QueryChain> queries = new ArrayList<>();
private Annotation annotation;
- private Sources sources;
Query(Sources sources, QueryChain queryChain) {
this.sources = sources;
diff --git a/client/src/main/java/ai/vespa/client/dsl/UserInput.java b/client/src/main/java/ai/vespa/client/dsl/UserInput.java
index de048c57574..66f7da5d059 100644
--- a/client/src/main/java/ai/vespa/client/dsl/UserInput.java
+++ b/client/src/main/java/ai/vespa/client/dsl/UserInput.java
@@ -3,7 +3,7 @@ package ai.vespa.client.dsl;
import java.util.UUID;
-public class UserInput extends QueryChain {
+public class UserInput extends Query {
private final Annotation annotation; // accept only defaultIndex annotation
private final String value;
@@ -16,7 +16,7 @@ public class UserInput extends QueryChain {
}
UserInput(Sources sources, Annotation annotation, String value) {
- this.sources = sources;
+ super(sources);
this.annotation = annotation;
this.value = value;
this.valueIsReference = value.startsWith("@");
@@ -56,22 +56,26 @@ public class UserInput extends QueryChain {
}
@Override
- boolean hasPositiveSearchField(String fieldName) {
+ public boolean hasPositiveSearchField(String fieldName) {
+ if (super.hasPositiveSearchField(fieldName)) return true;
return !"andnot".equals(this.op) && this.indexField.equals(fieldName);
}
@Override
- boolean hasPositiveSearchField(String fieldName, Object value) {
+ public boolean hasPositiveSearchField(String fieldName, Object value) {
+ if (super.hasPositiveSearchField(fieldName, value)) return true;
return hasPositiveSearchField(fieldName) && this.value.equals(value);
}
@Override
- boolean hasNegativeSearchField(String fieldName) {
+ public boolean hasNegativeSearchField(String fieldName) {
+ if (super.hasNegativeSearchField(fieldName)) return true;
return "andnot".equals(this.op) && this.indexField.equals(fieldName);
}
@Override
- boolean hasNegativeSearchField(String fieldName, Object value) {
+ public boolean hasNegativeSearchField(String fieldName, Object value) {
+ if (super.hasNegativeSearchField(fieldName, value)) return true;
return hasNegativeSearchField(fieldName) && this.value.equals(value);
}