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

Commita88a480

Browse files
committed
Introduce filtering dictionary support to tsearch. Propagate --nolocale option
to CREATE DATABASE command in pg_regress to allow correct checking oflocale-sensitive contrib modules.
1 parent77dfb64 commita88a480

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

‎src/backend/tsearch/ts_parse.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/tsearch/ts_parse.c,v 1.13 2009/07/16 06:33:44 petere Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/ts_parse.c,v 1.14 2009/08/18 10:30:41 teodor Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -29,7 +29,6 @@ typedef struct ParsedLex
2929
inttype;
3030
char*lemm;
3131
intlenlemm;
32-
boolresfollow;
3332
structParsedLex*next;
3433
}ParsedLex;
3534

@@ -189,6 +188,8 @@ LexizeExec(LexizeData *ld, ParsedLex **correspondLexem)
189188
while (ld->towork.head)
190189
{
191190
ParsedLex*curVal=ld->towork.head;
191+
char*curValLemm=curVal->lemm;
192+
intcurValLenLemm=curVal->lenlemm;
192193

193194
map=ld->cfg->map+curVal->type;
194195

@@ -208,8 +209,8 @@ LexizeExec(LexizeData *ld, ParsedLex **correspondLexem)
208209
res= (TSLexeme*)DatumGetPointer(FunctionCall4(
209210
&(dict->lexize),
210211
PointerGetDatum(dict->dictData),
211-
PointerGetDatum(curVal->lemm),
212-
Int32GetDatum(curVal->lenlemm),
212+
PointerGetDatum(curValLemm),
213+
Int32GetDatum(curValLenLemm),
213214
PointerGetDatum(&ld->dictState)
214215
));
215216

@@ -231,6 +232,13 @@ LexizeExec(LexizeData *ld, ParsedLex **correspondLexem)
231232
if (!res)/* dictionary doesn't know this lexeme */
232233
continue;
233234

235+
if (res->flags&TSL_FILTER )
236+
{
237+
curValLemm=res->lexeme;
238+
curValLenLemm=strlen(res->lexeme);
239+
continue;
240+
}
241+
234242
RemoveHead(ld);
235243
setCorrLex(ld,correspondLexem);
236244
returnres;

‎src/include/tsearch/ts_public.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1998-2009, PostgreSQL Global Development Group
88
*
9-
* $PostgreSQL: pgsql/src/include/tsearch/ts_public.h,v 1.15 2009/07/16 06:33:45 petere Exp $
9+
* $PostgreSQL: pgsql/src/include/tsearch/ts_public.h,v 1.16 2009/08/18 10:30:41 teodor Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -101,6 +101,7 @@ typedef struct
101101

102102
#defineTSL_ADDPOS0x01
103103
#defineTSL_PREFIX0x02
104+
#defineTSL_FILTER0x04
104105

105106
/*
106107
* Struct for supporting complex dictionaries like thesaurus.

‎src/test/regress/pg_regress.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.63 2009/06/11 14:49:15 momjian Exp $
14+
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.64 2009/08/18 10:30:41 teodor Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -1767,9 +1767,11 @@ create_database(const char *dbname)
17671767
*/
17681768
header(_("creating database \"%s\""),dbname);
17691769
if (encoding)
1770-
psql_command("postgres","CREATE DATABASE \"%s\" TEMPLATE=template0 ENCODING='%s'",dbname,encoding);
1770+
psql_command("postgres","CREATE DATABASE \"%s\" TEMPLATE=template0 ENCODING='%s'%s",dbname,encoding,
1771+
(nolocale) ?" LC_COLLATE='C' LC_CTYPE='C'" :"");
17711772
else
1772-
psql_command("postgres","CREATE DATABASE \"%s\" TEMPLATE=template0",dbname);
1773+
psql_command("postgres","CREATE DATABASE \"%s\" TEMPLATE=template0%s",dbname,
1774+
(nolocale) ?" LC_COLLATE='C' LC_CTYPE='C'" :"");
17731775
psql_command(dbname,
17741776
"ALTER DATABASE \"%s\" SET lc_messages TO 'C';"
17751777
"ALTER DATABASE \"%s\" SET lc_monetary TO 'C';"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp