-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move custom word from /base/${DATABASE_ID}/zhprs_dict_${DATABASE_NAME}.txt to /base/zhprs_dict_${DATABASE_NAME}.txt(data dir don't have /base/${DATABASE_ID} when tablespace is setted)
- Loading branch information
1 parent
e909539
commit 26b4cfa
Showing
6 changed files
with
29 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
CREATE or REPLACE FUNCTION sync_zhprs_custom_word() RETURNS void LANGUAGE plpgsql AS | ||
$$ | ||
declare | ||
data_dir text; | ||
dict_path text; | ||
time_tag_path text; | ||
query text; | ||
begin | ||
select setting from pg_settings where name='data_directory' into data_dir; | ||
|
||
select data_dir || '/base/' || '/zhprs_dict_' || current_database() || '.txt' into dict_path; | ||
select data_dir || '/base/' || '/zhprs_dict_' || current_database() || '.tag' into time_tag_path; | ||
|
||
query = 'copy (select word, tf, idf, attr from zhparser.zhprs_custom_word) to ' || chr(39) || dict_path || chr(39) || ' encoding ' || chr(39) || 'utf8' || chr(39) ; | ||
execute query; | ||
query = 'copy (select now()) to ' || chr(39) || time_tag_path || chr(39) ; | ||
execute query; | ||
end; | ||
$$; | ||
|
||
select sync_zhprs_custom_word(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
comment = 'a parser for full-text search of Chinese' | ||
default_version = '2.1' | ||
default_version = '2.2' | ||
module_pathname = '$libdir/zhparser' | ||
relocatable = true |