зеркало из https://github.com/golang/pkgsite.git
migrations: add documents.tsv_search_tokens
Rather than storing the tsvector data for name, path, synopsis and readme separately, they will now to be stored together in a tsv_search_tokens, which has been shown to improve performance for the search query. Change-Id: I80460b3a9e22efbe642419e37b95e10ed2c73d9f Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/455288 Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Родитель
f1880ff549
Коммит
2e1a49407d
|
@ -0,0 +1,9 @@
|
|||
-- Copyright 2019 The Go Authors. All rights reserved.
|
||||
-- Use of this source code is governed by a BSD-style
|
||||
-- license that can be found in the LICENSE file.
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE documents DROP COLUMN tsv_search_tokens;
|
||||
|
||||
END;
|
|
@ -0,0 +1,16 @@
|
|||
-- Copyright 2019 The Go Authors. All rights reserved.
|
||||
-- Use of this source code is governed by a BSD-style
|
||||
-- license that can be found in the LICENSE file.
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE documents ADD COLUMN tsv_search_tokens tsvector;
|
||||
CREATE INDEX tsv_search_tokens_idx ON documents USING gin(tsv_search_tokens);
|
||||
|
||||
UPDATE documents SET tsv_search_tokens =
|
||||
name_tokens ||
|
||||
path_tokens ||
|
||||
synopsis_tokens ||
|
||||
readme_tokens;
|
||||
|
||||
END;
|
Загрузка…
Ссылка в новой задаче