aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2022-11-21 09:48:35 +0100
committerGitHub <noreply@github.com>2022-11-21 09:48:35 +0100
commit1b8a045f072ac5a359bd76e3d0670de98c813716 (patch)
tree25de1876c0c6d2f3d48d04a9b0923f41c6d5d618 /client
parent75463c873ed404ffa39c5b8ac21810819a4b3a62 (diff)
parent50df4b41a631ff5186ad8b3edf0b8d02b6d79b80 (diff)
Merge pull request #24934 from vespa-engine/bratseth/extend-query
Allow chaining directly to userinput
Diffstat (limited to 'client')
-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);
}