aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/examples/rankingexpressionfunction/rankingexpressionfunction.sd
blob: 04dde538e551b794854595a62934c55fa7cfb062 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
search rankexpression {

  document rankexpression {

    field artist type string {
      indexing: summary | index
    }

    field title type string {
      indexing: summary | index
    }

    field surl type string {
      indexing: summary
    }

    field year type int {
      indexing: summary | attribute
    }

  }

  rank-profile macros {
    function titlematch(var1, var2) {
      expression: file: titlematch
    }

    function artistmatch() {
      expression: 78+closeness(distance)
    }

    first-phase {
      expression: 0.8+0.2*titlematch(4,5)+0.8*titlematch(7,8)*closeness(distance)
    }

  }

}