mirror of
https://github.com/outline/outline.git
synced 2026-04-28 21:49:32 -05:00
Tweak search weights
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface) => {
|
||||
const searchDocument = `
|
||||
CREATE OR REPLACE FUNCTION documents_search_trigger() RETURNS trigger AS $$
|
||||
begin
|
||||
new."searchVector" :=
|
||||
setweight(to_tsvector('english', coalesce(new.title, '')),'A') ||
|
||||
setweight(to_tsvector('english', coalesce(array_to_string(new."previousTitles", ' , '),'')),'C') ||
|
||||
setweight(to_tsvector('english', substring(coalesce(new.text, ''), 1, 1000000)), 'D');
|
||||
return new;
|
||||
end
|
||||
$$ LANGUAGE plpgsql;
|
||||
`;
|
||||
await queryInterface.sequelize.query(searchDocument);
|
||||
},
|
||||
down: async (queryInterface) => {
|
||||
const searchDocument = `
|
||||
CREATE OR REPLACE FUNCTION documents_search_trigger() RETURNS trigger AS $$
|
||||
begin
|
||||
new."searchVector" :=
|
||||
setweight(to_tsvector('english', coalesce(new.title, '')),'A') ||
|
||||
setweight(to_tsvector('english', coalesce(array_to_string(new."previousTitles", ' , '),'')),'C') ||
|
||||
setweight(to_tsvector('english', substring(coalesce(new.text, ''), 1, 1000000)), 'B');
|
||||
return new;
|
||||
end
|
||||
$$ LANGUAGE plpgsql;
|
||||
`;
|
||||
await queryInterface.sequelize.query(searchDocument);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user