diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-10-28 16:09:25 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-10-28 16:09:25 +0200 |
commit | 4f6b6585cbcd7340c1b89ed3512c35b97f33bd7a (patch) | |
tree | 1c65c364813b33398c154083d49aabff3b25167c /client/src/test/java | |
parent | 44595d372748d960535e72ab5086fc1412db867c (diff) |
Improvements to iserInput handling
- Handle both direct values and references in userInput
- Don't convert direct values to references
- Accept any QueryChain in rank
Diffstat (limited to 'client/src/test/java')
-rw-r--r-- | client/src/test/java/ai/vespa/client/dsl/QTest.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/client/src/test/java/ai/vespa/client/dsl/QTest.java b/client/src/test/java/ai/vespa/client/dsl/QTest.java index a249bc91411..114cbee0177 100644 --- a/client/src/test/java/ai/vespa/client/dsl/QTest.java +++ b/client/src/test/java/ai/vespa/client/dsl/QTest.java @@ -165,15 +165,24 @@ class QTest { } @Test - void userInput_with_and_with_out_defaultIndex() { + void userInput_with_and_without_defaultIndex() { String q = Q.select("*") .from("sd1") - .where(Q.ui("value")) + .where(Q.ui("value1")) .and(Q.ui("index", "value2")) .semicolon() .build(); + assertEquals("yql=select * from sd1 where userInput(\"value1\") and ({\"defaultIndex\":\"index\"}userInput(\"value2\"));", q); + } - assertEquals(q, "yql=select * from sd1 where userInput(@_1) and ([{\"defaultIndex\":\"index\"}]userInput(@_2_index));&_2_index=value2&_1=value"); + @Test + void userInput_with_rank() { + String q = Q.select("url") + .from("site") + .where(Q.rank(Q.p("docQ").nearestNeighbor("vectorQuery"), + Q.ui("@query"))) + .semicolon().build(); + assertEquals("yql=select url from site where rank(nearestNeighbor(docQ, vectorQuery), userInput(@query));", q); } @Test @@ -185,7 +194,7 @@ class QTest { .semicolon() .build(); - assertEquals(q, "yql=select * from sd1 where dotProduct(f1, {\"a\":1,\"b\":2,\"c\":3}) and f2 contains \"1\";"); + assertEquals("yql=select * from sd1 where dotProduct(f1, {\"a\":1,\"b\":2,\"c\":3}) and f2 contains \"1\";", q); } @Test |