aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/derived/rankproperties/rankproperties.sd
blob: a13b3081ca72fa6ae6d98575f673d359836de7be (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
schema rankproperties {

  document rankproperties {

    field title type string {
      indexing: index
      weight: 50
    }

    field description type string {
      indexing: index
      weight: 10
    }

    field tag type string {
      indexing: attribute
    }

  }

  rank-profile default {
    weight tag: 33
    first-phase {
      expression: nativeFieldMatch
    }
    second-phase {
      expression: match
    }
    rank-properties {
      $test1:"foo"
      query(test2): 12.3
      #$weight:1
    }
  }

  rank-profile child inherits default {
    weight title: 15
    #rank-properties {
    #  $test:"bar"
    #  $weight:2
    #}
    #first-phase {
    #  expression {
    #    $weight
    #  }
    #}
  }

  rank-profile standalone {
    weight description: 35
    weight tag: 88

    first-phase {
      expression: match + fieldMatch(title)
    }
    second-phase {
      expression: match + nativeFieldMatch
    }
  }

  rank-profile withconstants1 {
    constants {
      constant(a) tensor(x[2]) : [1,2]
      constant(b) tensor(y[3]) : [3,4,5]
    }
    function inline usea() {
      expression: constant(a)*1.0
    }
    function inline useb() {
      expression: usea + constant(b)
    }
    first-phase {
      expression: sum(nativeFieldMatch + useb)
    }
  }

  rank-profile withconstants2 inherits withconstants1 {
    function inline usec() {
      expression: constant(a)+constant(b)
    }
    first-phase {
      expression: sum(nativeFieldMatch + usec)
    }
  }
}