1/**
2 * Simple search result scoring code.
3 *
4 * Copyright 2007-2018 by the Sphinx team
5 * Copyright (c) 2019-2022, Intel Corporation.
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9var Scorer = {
10  // Implement the following function to further tweak the score for
11  // each result The function takes a result array [filename, title,
12  // anchor, descr, score] and returns the new score.
13
14  // For ACRN search results, push display down for release_notes and
15  // api docs so "regular" docs will show up before them
16
17  score: function(result) {
18
19    if (result[0].search("release_notes/")>=0) {
20       return -6;
21    }
22    else if (result[0].search("api/")>=0) {
23       return -5;
24    }
25    else if (result[0].search("kconfig/")>=0) {
26       return -5;
27    }
28    else {
29       return result[4];
30    }
31  },
32
33  // query matches the full name of an object
34  objNameMatch: 11,
35  // or matches in the last dotted part of the object name
36  objPartialMatch: 6,
37  // Additive scores depending on the priority of the object
38  objPrio: {0:  15,   // used to be importantResults
39            1:  5,   // used to be objectResults
40            2: -5},  // used to be unimportantResults
41  //  Used when the priority is not in the mapping.
42  objPrioDefault: 0,
43
44  // query found in title
45  title: 15,
46  // query found in terms
47  term: 5
48};
49