Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd3e36da

Browse files
committed
Make the standard stopword files be sought relative to share_dir, so
that a tsearch2 installation can be relocatable.
1 parent4347cc2 commitd3e36da

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

‎contrib/tsearch2/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/contrib/tsearch2/Makefile,v 1.7 2004/08/20 20:13:09 momjian Exp $
1+
# $PostgreSQL: pgsql/contrib/tsearch2/Makefile,v 1.8 2004/10/17 23:09:31 tgl Exp $
22

33
MODULE_big = tsearch2
44
OBJS = dict_ex.o dict.o snmap.o stopword.o common.o prs_dcfg.o\
@@ -39,8 +39,7 @@ $(SUBDIRS:%=%-recursive):
3939
$(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
4040

4141
tsearch2.sql: tsearch.sql.in
42-
sed -e's,MODULE_PATHNAME,$$libdir/$(MODULE_big),g'\
43-
-e's,DATA_PATH,$(datadir)/contrib,g'$<>$@
42+
sed -e's,MODULE_PATHNAME,$$libdir/$(MODULE_big),g'$<>$@
4443

4544
untsearch2.sql: untsearch.sql.in
4645
cp$<$@

‎contrib/tsearch2/stopword.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
* stopword library
33
* Teodor Sigaev <teodor@sigaev.ru>
44
*/
5-
#include<errno.h>
6-
#include<stdlib.h>
7-
#include<string.h>
5+
#include"postgres.h"
6+
87
#include<ctype.h>
98

10-
#include"postgres.h"
9+
#include"miscadmin.h"
10+
1111
#include"common.h"
1212
#include"dict.h"
1313

@@ -51,10 +51,23 @@ readstoplist(text *in, StopList * s)
5151
if (in&&VARSIZE(in)-VARHDRSZ>0)
5252
{
5353
char*filename=text2char(in);
54-
FILE*hin=NULL;
54+
FILE*hin;
5555
charbuf[STOPBUFLEN];
5656
intreallen=0;
5757

58+
/* if path is relative, take it as relative to share dir */
59+
if (!is_absolute_path(filename))
60+
{
61+
charsharepath[MAXPGPATH];
62+
char*absfn;
63+
64+
get_share_path(my_exec_path,sharepath);
65+
absfn=palloc(strlen(sharepath)+strlen(filename)+2);
66+
sprintf(absfn,"%s/%s",sharepath,filename);
67+
pfree(filename);
68+
filename=absfn;
69+
}
70+
5871
if ((hin=fopen(filename,"r"))==NULL)
5972
ereport(ERROR,
6073
(errcode(ERRCODE_CONFIG_FILE_ERROR),

‎contrib/tsearch2/tsearch.sql.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ CREATE FUNCTION snb_lexize(internal,internal,int4)
7777
insert into pg_ts_dict select
7878
'en_stem',
7979
'snb_en_init(text)',
80-
'DATA_PATH/english.stop',
80+
'contrib/english.stop',
8181
'snb_lexize(internal,internal,int4)',
8282
'English Stemmer. Snowball.'
8383
;
@@ -90,7 +90,7 @@ CREATE FUNCTION snb_ru_init(text)
9090
insert into pg_ts_dict select
9191
'ru_stem',
9292
'snb_ru_init(text)',
93-
'DATA_PATH/russian.stop',
93+
'contrib/russian.stop',
9494
'snb_lexize(internal,internal,int4)',
9595
'Russian Stemmer. Snowball.'
9696
;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp