diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-11-10 20:59:00 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-11-10 20:59:00 +0100 |
commit | 15b3db0dfa32b87df0e24a968335ccf5d690ed16 (patch) | |
tree | a7b3fc8458a6cb3e621fa084f4b3f6f94b834a09 /container-search/src/test/java/com/yahoo/search/query | |
parent | b26cbb29aec75b76767e6e1631eae2a11f035823 (diff) |
Don't interpret ref: as a query profile ref unnecessarily
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/query')
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java b/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java index 7a4247f2584..c4541fe9f58 100644 --- a/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java @@ -3,6 +3,10 @@ package com.yahoo.search.query.profile.test; import com.yahoo.jdisc.http.HttpRequest.Method; import com.yahoo.container.jdisc.HttpRequest; +import com.yahoo.prelude.Index; +import com.yahoo.prelude.IndexFacts; +import com.yahoo.prelude.IndexModel; +import com.yahoo.prelude.SearchDefinition; import com.yahoo.processing.request.CompoundName; import com.yahoo.processing.request.Properties; import com.yahoo.search.Query; @@ -12,6 +16,7 @@ import com.yahoo.search.query.profile.QueryProfileProperties; import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.search.query.profile.compiled.CompiledQueryProfile; import com.yahoo.search.query.profile.compiled.ValueWithSource; +import com.yahoo.search.searchchain.Execution; import com.yahoo.yolean.trace.TraceNode; import org.junit.jupiter.api.Test; @@ -342,6 +347,21 @@ public class QueryProfileTestCase { assertEquals("de", query.getModel().getLanguage().languageCode()); } + /** Tests that the ref: here is not mistaken for a query profile reference. */ + @Test + void testReferenceAsQueryString() { + SearchDefinition sd = new SearchDefinition("test"); + sd.addIndex(new Index("someField")); + IndexFacts facts = new IndexFacts(new IndexModel(sd)); + + var profile = new QueryProfile("test"); + var registry = new QueryProfileRegistry(); + registry.register(profile); + var query = new Query("?query=ref:", registry.compile().findQueryProfile("test")); + query.getModel().setExecution(new Execution(Execution.Context.createContextStub(facts))); + assertEquals("WEAKAND(100) ref", query.getModel().getQueryTree().getRoot().toString()); + } + /** Dots are followed when setting overridability, also with variants */ @Test void testInstanceOverridableWithVariants() { |