mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08:00
Make the standard stopword files be sought relative to share_dir, so
that a tsearch2 installation can be relocatable.
This commit is contained in:
parent
4347cc2392
commit
d3e36da789
@ -1,4 +1,4 @@
|
||||
# $PostgreSQL: pgsql/contrib/tsearch2/Makefile,v 1.7 2004/08/20 20:13:09 momjian Exp $
|
||||
# $PostgreSQL: pgsql/contrib/tsearch2/Makefile,v 1.8 2004/10/17 23:09:31 tgl Exp $
|
||||
|
||||
MODULE_big = tsearch2
|
||||
OBJS = dict_ex.o dict.o snmap.o stopword.o common.o prs_dcfg.o \
|
||||
@ -39,8 +39,7 @@ $(SUBDIRS:%=%-recursive):
|
||||
$(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
|
||||
|
||||
tsearch2.sql: tsearch.sql.in
|
||||
sed -e 's,MODULE_PATHNAME,$$libdir/$(MODULE_big),g' \
|
||||
-e 's,DATA_PATH,$(datadir)/contrib,g' $< >$@
|
||||
sed -e 's,MODULE_PATHNAME,$$libdir/$(MODULE_big),g' $< >$@
|
||||
|
||||
untsearch2.sql: untsearch.sql.in
|
||||
cp $< $@
|
||||
|
@ -2,12 +2,12 @@
|
||||
* stopword library
|
||||
* Teodor Sigaev <teodor@sigaev.ru>
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "postgres.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "postgres.h"
|
||||
#include "miscadmin.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "dict.h"
|
||||
|
||||
@ -51,10 +51,23 @@ readstoplist(text *in, StopList * s)
|
||||
if (in && VARSIZE(in) - VARHDRSZ > 0)
|
||||
{
|
||||
char *filename = text2char(in);
|
||||
FILE *hin = NULL;
|
||||
FILE *hin;
|
||||
char buf[STOPBUFLEN];
|
||||
int reallen = 0;
|
||||
|
||||
/* if path is relative, take it as relative to share dir */
|
||||
if (!is_absolute_path(filename))
|
||||
{
|
||||
char sharepath[MAXPGPATH];
|
||||
char *absfn;
|
||||
|
||||
get_share_path(my_exec_path, sharepath);
|
||||
absfn = palloc(strlen(sharepath) + strlen(filename) + 2);
|
||||
sprintf(absfn, "%s/%s", sharepath, filename);
|
||||
pfree(filename);
|
||||
filename = absfn;
|
||||
}
|
||||
|
||||
if ((hin = fopen(filename, "r")) == NULL)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_CONFIG_FILE_ERROR),
|
||||
|
@ -77,7 +77,7 @@ CREATE FUNCTION snb_lexize(internal,internal,int4)
|
||||
insert into pg_ts_dict select
|
||||
'en_stem',
|
||||
'snb_en_init(text)',
|
||||
'DATA_PATH/english.stop',
|
||||
'contrib/english.stop',
|
||||
'snb_lexize(internal,internal,int4)',
|
||||
'English Stemmer. Snowball.'
|
||||
;
|
||||
@ -90,7 +90,7 @@ CREATE FUNCTION snb_ru_init(text)
|
||||
insert into pg_ts_dict select
|
||||
'ru_stem',
|
||||
'snb_ru_init(text)',
|
||||
'DATA_PATH/russian.stop',
|
||||
'contrib/russian.stop',
|
||||
'snb_lexize(internal,internal,int4)',
|
||||
'Russian Stemmer. Snowball.'
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user