/usr/share/lua/5.1/saci/search.lua is in sputnik 12.06.27-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | -----------------------------------------------------------------------------
-- Defines functions for searching Saci data.
--
--
-- (c) 2007, 2008 Yuri Takhteyev (yuri@freewisdom.org)
-- License: MIT/X, see http://sputnik.freewisdom.org/en/License
-----------------------------------------------------------------------------
function rank_hits(hits, node_map)
local weights = {} -- weight for each node ID
local node_ids = {} -- a list of node ids (to be sorted eventually)
for id, node in pairs(node_map) do
for term, hits_for_term in pairs(hits) do
if hits_for_term[id] then
weights[id] = (weights[id] or 0) + 5 + hits_for_term[id]
end
end
if weights[id] then
table.insert(node_ids, id)
end
end
table.sort(node_ids, function(x,y) return weights[x] > weights[y] end)
return node_ids, weights
end
|