1/** 2 * Simple search result scoring code. 3 * 4 * Copyright 2007-2018 by the Sphinx team 5 * Copyright (c) 2019, Intel 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 Zephyr search results, push display down for kconfig, boards, 15 // and samples so "regular" docs will show up before them 16 17 score: function(result) { 18 if (result[0].search("reference/kconfig/")>=0) { 19 return -5; 20 } 21 else if (result[0].search("boards/")>=0) { 22 return -5; 23 } 24 else if (result[0].search("samples/")>=0) { 25 return -5; 26 } 27 else { 28 return result[4]; 29 } 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