зеркало из https://github.com/golang/pkgsite.git
migrations: remove golang text configuration
The golang text configuration was intended to prevent stemming for terms like "postgres" and "NATS". However, it's too great a loss to drop stemming for other, ordinary English words (e.g. "logging" to "log"). And though "postgres" is stemmed to the nonsensical "postgr", that happens for both the document and the search query, so search quality isn't affected. Change-Id: I730590e27499fca9f70a3ce65a6e6ea364f4adda Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/712880 Reviewed-by: Julie Qiu <julieqiu@google.com>
This commit is contained in:
Родитель
56ebedf10a
Коммит
d31f748a30
|
@ -0,0 +1,31 @@
|
|||
-- Copyright 2020 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;
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION golang (COPY = pg_catalog.english);
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY simple_english (
|
||||
TEMPLATE = pg_catalog.simple,
|
||||
STOPWORDS = english
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION golang
|
||||
ALTER MAPPING FOR asciiword, asciihword, hword_asciipart, numword
|
||||
WITH simple_english;
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION golang
|
||||
DROP MAPPING FOR url_path;
|
||||
|
||||
|
||||
COMMENT ON TEXT SEARCH CONFIGURATION golang IS
|
||||
'TEXT SEARCH CONFIGURATION golang is a custom search configuration used when creating tsvector for search.
|
||||
The url_path token type is removed, so that "github.com/foo/bar@v1.2.3" is indexed only as the full URL string,
|
||||
and not also"/foo/bar@v1.2.3".
|
||||
The ASCII token types are set to a "simple_english" mapping, so that "plural" words like Postgres and NATS
|
||||
will be indexed without stemming.
|
||||
This idea came from the "Morphological and Exact Search" section here:
|
||||
https://asp437.github.io/posts/flexible-fts.html.';
|
||||
|
||||
END;
|
|
@ -0,0 +1,11 @@
|
|||
-- Copyright 2020 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;
|
||||
|
||||
DROP TEXT SEARCH CONFIGURATION golang;
|
||||
|
||||
DROP TEXT SEARCH DICTIONARY simple_english;
|
||||
|
||||
END;
|
Загрузка…
Ссылка в новой задаче