diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-01-31 19:56:36 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-01-31 19:56:36 +0100 |
commit | ba0bc7385db2e9d89fbf832b4b7e0f76459f028a (patch) | |
tree | 6b2db39d04373d5cd150a0afd1d9f890ada4df04 /config-model | |
parent | c99fe08dd762542b774f8d59e82da5f6ab076aa7 (diff) |
Test feature combination
Diffstat (limited to 'config-model')
2 files changed, 25 insertions, 5 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java index e54d348f904..86094458b34 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java @@ -32,13 +32,14 @@ class RankProfileSearchFixture { this(applicationpackage, rankProfiles, null, null); } - RankProfileSearchFixture(ApplicationPackage applicationpackage, String rankProfiles, String field, String constant) + RankProfileSearchFixture(ApplicationPackage applicationpackage, + String rankProfiles, String constant, String field) throws ParseException { SearchBuilder builder = new SearchBuilder(applicationpackage, rankProfileRegistry); String sdContent = "search test {\n" + - " " + (constant != null ? constant : "") + + " " + (constant != null ? constant : "") + "\n" + " document test {\n" + - (field != null ? field : "") + + " " + (field != null ? field : "") + "\n" + " }\n" + rankProfiles + "\n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java index 5637806f908..f7a46734c60 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java @@ -93,8 +93,27 @@ public class RankingExpressionWithTensorFlowTestCase { StoringApplicationPackage application = new StoringApplicationPackage(applicationDir); RankProfileSearchFixture search = fixtureWith("attribute(mytensor)", "tensorflow('mnist_softmax/saved')", - "field mytensor type tensor(d0[],d1[784]) { indexing: attribute }", null, + "field mytensor type tensor(d0[],d1[784]) { indexing: attribute }", + application); + search.assertFirstPhaseExpression(vespaExpression, "my_profile"); + assertConstant("Variable_1", search, Optional.of(10L)); + assertConstant("Variable", search, Optional.of(7840L)); + } + + @Test + public void testTensorFlowReferenceWithFeatureCombination() throws ParseException { + String queryProfile = "<query-profile id='default' type='root'/>"; + String queryProfileType = "<query-profile-type id='root'>" + + " <field name='mytensor' type='tensor(d0[3],d1[784])'/>" + + "</query-profile-type>"; + StoringApplicationPackage application = new StoringApplicationPackage(applicationDir, + queryProfile, + queryProfileType); + RankProfileSearchFixture search = fixtureWith("query(mytensor) * attribute(mytensor) * constant(mytensor)", + "tensorflow('mnist_softmax/saved')", + "constant mytensor { file: ignored\ntype: tensor(d0[7],d1[784]) }", + "field mytensor type tensor(d0[],d1[784]) { indexing: attribute }", application); search.assertFirstPhaseExpression(vespaExpression, "my_profile"); assertConstant("Variable_1", search, Optional.of(10L)); @@ -259,7 +278,7 @@ public class RankingExpressionWithTensorFlowTestCase { private RankProfileSearchFixture fixtureWith(String placeholderExpression, String firstPhaseExpression, String constant, String field) { - return fixtureWith(placeholderExpression, firstPhaseExpression, field, constant, + return fixtureWith(placeholderExpression, firstPhaseExpression, constant, field, new StoringApplicationPackage(applicationDir)); } |