diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-02-07 14:58:05 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-02-07 14:58:05 +0100 |
commit | a4d2d2993550e256d2d811f1ab6c36675b026ecd (patch) | |
tree | f2f1c5173053eda0f27f614b52f482aaf1b07fb5 | |
parent | 70227078bed8a4eed2a297af84b10783456e84a7 (diff) |
Add a test
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java b/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java index 312fe175270..3b0a0ad7972 100644 --- a/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java @@ -1092,6 +1092,35 @@ public class QueryTestCase { query.getSelect().getGrouping().toString()); } + /** + * Tests that the value presentation.format.tensors can be set in a query profile. + * This is special because presentation.format is a native query profile. + */ + @Test + public void testSettingNativeQueryProfileValueInQueryProfile() { + { + QueryProfileRegistry registry = new QueryProfileRegistry(); + QueryProfile profile = new QueryProfile("default"); + profile.set("presentation.format.tensors", "short", Map.of(), registry); + registry.register(profile); + CompiledQueryProfileRegistry cRegistry = registry.compile(); + Query query = new Query("?query=foo", cRegistry.findQueryProfile("default")); + assertTrue(query.getPresentation().getTensorShortForm()); + } + + { // Same as above but also set presentation.format + QueryProfileRegistry registry = new QueryProfileRegistry(); + QueryProfile profile = new QueryProfile("default"); + profile.set("presentation.format", "xml", Map.of(), registry); + profile.set("presentation.format.tensors", "short", Map.of(), registry); + registry.register(profile); + CompiledQueryProfileRegistry cRegistry = registry.compile(); + Query query = new Query("?query=foo", cRegistry.findQueryProfile("default")); + assertEquals("xml", query.getPresentation().getFormat()); + assertTrue(query.getPresentation().getTensorShortForm()); + } + } + private void assertDetectionText(String expectedDetectionText, String queryString, String ... indexSpecs) { Query q = new Query(httpEncode("/?query=" + queryString)); SearchDefinition sd = new SearchDefinition("testSearchDefinition"); |