aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/derived/advanced/advanced.sd
blob: 98a403dc44ea7699a81a30ca13342a62fd102f51 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
schema advanced {
    document advanced {
        field debug_src      type string { }
        field attributes_src type string { }
        field location_str   type string { }
        field title_src      type string { }
        field product_src    type string { }
        field product2_src   type string { }
        field product3_src   type string { }
    }
        field debug type string {
          indexing {

            # Initialize variables used for superduper ranking
            0 | set_var superduperus | set_var superdupereu | set_var superduperasia;

            input debug_src | lowercase | summary | index | split ";" | for_each {
              # Loop through each token in debug string
              switch {
                case "superduperus": 10 | set_var superduperus;
                case "superdupereu": 10 | set_var superdupereu;
                case "superduperasia": 10 | set_var superduperasia;
              }
            };
          }
          stemming: none
        }

        field attributes type string {
          indexing {

            # Initialize variables used for superduper ranking
            1 | set_var superdupermod;
            2 | set_var tmppubdate;
            input attributes_src | lowercase | summary | index | split ";" | for_each {
              # Loop through each token in attributes string
              switch {

                # De-rank PR articles using the following rules:
                #   1. Set editedstaticrank to '1'
                #   2. Subtract 2.5 hours (9000 seconds) from timestamp used in ranking
                #   3. No superduper rank
                case "typepr": 1 | set_var tmpsourcerank | get_var tmppubdate - 9000 | set_var tmppubdate | 0 | set_var superdupermod;
              }
            };
          }
          stemming: none
        }

        field title type string {
          indexing: input title_src | index
          rank-type: identity
          stemming: none
          alias: headline
        }

        field title_s type string {
          indexing: input title_src | summary
        }

 	    field product type string {
	      indexing: input product_src | switch {
		      case "": "myweb" | index | summary;
		      default: input product_src | index | summary;
	        }
	      normalizing: none
        }

        field product2 type string {
          indexing {
	        if (input product2_src == "foo") {
	          "bar" | index product2;
	        } else {
	          "baz" | index product2;
	        };
          }
          normalizing: none
        }

        field product3 type string {
          indexing: input product3_src | switch {
 		      case "": "myweb" | index product3 | summary product3;
 		      default: input product3_src | index product3 | summary product3;
 	        }
 	      normalizing: none
 	    }

    field location type position {
        indexing: input location_str | to_pos | attribute
    }
    field mysummary type string {
        indexing: input title_src | summary
    }
    fieldset titleabstract {
      fields: title
    }
    raw-as-base64-in-summary : true
    fieldset default {
      fields: title
    }
}