summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2020-09-29 22:19:23 +0200
committerGitHub <noreply@github.com>2020-09-29 22:19:23 +0200
commitf83097341198f7908e795c7fd3205b661d053b61 (patch)
tree9eb6a7829bf96f78f49cc9a0b00cf32a9867c916 /config-model
parent44bbdcc733949306595bb1cc5041455ec29ba8ad (diff)
parent91e3973bd7185d2ddc3514fda2027b4caf4939dc (diff)
Merge pull request #14613 from vespa-engine/bratseth/rank-profile-model
Support 'model' instead of 'rank-profile'
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/javacc/SDParser.jj4
-rw-r--r--config-model/src/test/derived/rankprofiles/rankprofiles.sd18
-rw-r--r--config-model/src/test/examples/desktop.sd108
3 files changed, 12 insertions, 118 deletions
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj
index bf752b39fa8..3bbcf7979f3 100644
--- a/config-model/src/main/javacc/SDParser.jj
+++ b/config-model/src/main/javacc/SDParser.jj
@@ -233,6 +233,7 @@ TOKEN :
| < SUFFIX: "suffix" >
| < CONSTANT: "constant">
| < ONNXMODEL: "onnx-model">
+| < MODEL: "model" >
| < RANKPROFILE: "rank-profile" >
| < RANKDEGRADATIONFREQ: "rank-degradation-frequency" >
| < RANKDEGRADATION: "rank-degradation" >
@@ -1976,7 +1977,7 @@ void rankProfile(Search search) :
RankProfile profile;
}
{
- ( <RANKPROFILE> name = identifierWithDash()
+ ( ( <MODEL> | <RANKPROFILE> ) name = identifierWithDash()
{
if (documentsOnly) {
profile = new DocumentsOnlyRankProfile(name, search, rankProfileRegistry);
@@ -2676,6 +2677,7 @@ String identifier() : { }
| <QUATERNARY>
| <QUERYCOMMAND>
| <RANK>
+ | <MODEL>
| <RANKPROFILE>
| <RANKPROPERTIES>
| <RANKSCOREDROPLIMIT>
diff --git a/config-model/src/test/derived/rankprofiles/rankprofiles.sd b/config-model/src/test/derived/rankprofiles/rankprofiles.sd
index abafee91533..6c3720df589 100644
--- a/config-model/src/test/derived/rankprofiles/rankprofiles.sd
+++ b/config-model/src/test/derived/rankprofiles/rankprofiles.sd
@@ -19,21 +19,21 @@ search rankprofiles {
}
- rank-profile default {
+ model default {
}
- rank-profile other1 inherits default {
+ model other1 inherits default {
rank field1: filter
rank none: filter
}
- rank-profile other2 inherits other1 {
+ model other2 inherits other1 {
}
- rank-profile other3 {
+ model other3 {
}
- rank-profile four {
+ model four {
match-phase {
attribute: field2
order: ascending
@@ -41,7 +41,7 @@ search rankprofiles {
}
}
- rank-profile five {
+ model five {
match-phase {
attribute: field2
order: descending
@@ -49,14 +49,14 @@ search rankprofiles {
}
}
- rank-profile six {
+ model six {
match-phase {
attribute: field3
max-hits: 666
}
}
- rank-profile seven {
+ model seven {
match-phase {
attribute: field3
max-hits:800
@@ -65,7 +65,7 @@ search rankprofiles {
}
}
- rank-profile eight inherits seven {
+ model eight inherits seven {
}
diff --git a/config-model/src/test/examples/desktop.sd b/config-model/src/test/examples/desktop.sd
deleted file mode 100644
index 82741dbe53f..00000000000
--- a/config-model/src/test/examples/desktop.sd
+++ /dev/null
@@ -1,108 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-# A search definition of medium complexity
-search desktop {
-
- # A document with some fields.
- # The fields implicitly defines some indices, summary fields and attributes
- document desktop inherits product {
-
- field title type text {
- mandatory: true
- indexing: summary | attribute | index_text
- # index-to: title, default
-
- rank-weight: 300
- rank-type: identity
- }
-
- field manufacturer type text {
- indexing: summary | attribute | index
- # index-to: manufacturer, default
- alias: producer, brand
-
- rank-type: identity
- rank-weight:200
- }
-
- field description type text {
- indexing: summary | index
-
- rank-type: about
- rank-weight: 100
- result-transform: dynamicteaser
- }
-
- field category type text {
- indexing: index
- # index-to: category, default
- rank-weight: 50
- }
-
- field minprice type int {
- indexing: summary | attribute | index
- index-decimals: 2
-
- rank-type: simple
- weight: 30
- staticrankbits: 16
- }
-
- field someorder type int {
- indexing: attribute someorderranking
- staticrankbits someorderranking: 32
- }
-
- # index_url implicitly defines some fields not contained in the document (contexts)
- # If attributes needs to be set on these, it can be done by explicitly listing
- # the fields outside documents (show).
- # I think we should maybe allow setting such field attributes inside the parent
- # field as well for convenience. Both is shown.
- field url type url {
- # Should index mean index_url for url type fields?
- indexing: summary | index_url
- parse-mode: url # Must be default for url types, but shown here anyway
-
- rank-type: link
- }
-
- }
-
- field category_arr type array<text> {
- indexing: input category | split ";" | attribute category_arr
- }
-
- # Overriding some url field setting from rank-type link
- field url.host {
- weight: 1000
- }
-
- # Setting an attribute on a non-field index
- # This is redunant, as default is default
- index default {
- default: true
- }
-
- # Optionally specify a desire to use a shared dictionary ("catalogs")
- shared-dictionary: normal, title, manufacturer
-
- # Optionally set rank values for all indices
- # Default is the name of the default one
- # Rank settings from individual fields can be selectively overridden
- rankprofile default {
- firstocc-boost text: 200
- }
-
- # Another rank profile
- rankprofile predefinedorder {
- dynamicranking: off
- attribute: someorder
- }
-
- # Some experimental ranking changes
- rankprofile experimental inherits default {
- firstocc-boost text: 300
- }
-
-}
-
-