Skip to content

Commit d015d08

Browse files
committed
Rename default text search parser's "uri" token type to "url_path",
per recommendation from Alvaro. This doesn't force initdb since the numeric token type in the catalogs doesn't change; but note that the expected regression test output changed.
1 parent 834ddc6 commit d015d08

File tree

4 files changed

+40
-39
lines changed

4 files changed

+40
-39
lines changed

doc/src/sgml/textsearch.sgml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.27 2007/10/27 00:19:45 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.28 2007/10/27 16:01:08 tgl Exp $ -->
22

33
<chapter id="textsearch">
44
<title id="textsearch-title">Full Text Search</title>
@@ -1815,8 +1815,8 @@ LIMIT 10;
18151815
<entry><literal>example.com</literal></entry>
18161816
</row>
18171817
<row>
1818-
<entry><literal>uri</></entry>
1819-
<entry>URI</entry>
1818+
<entry><literal>url_path</></entry>
1819+
<entry>URL path</entry>
18201820
<entry><literal>/stuff/index.html</literal>, in the context of a URL</entry>
18211821
</row>
18221822
<row>
@@ -1907,7 +1907,7 @@ SELECT alias, description, token FROM ts_debug('http://example.com/stuff/index.h
19071907
protocol | Protocol head | http://
19081908
url | URL | example.com/stuff/index.html
19091909
host | Host | example.com
1910-
uri | URI | /stuff/index.html
1910+
url_path | URL path | /stuff/index.html
19111911
</programlisting>
19121912
</para>
19131913

@@ -2632,7 +2632,7 @@ ALTER TEXT SEARCH CONFIGURATION pg
26322632

26332633
<programlisting>
26342634
ALTER TEXT SEARCH CONFIGURATION pg
2635-
DROP MAPPING FOR email, url, sfloat, uri, float;
2635+
DROP MAPPING FOR email, url, url_path, sfloat, float;
26362636
</programlisting>
26372637
</para>
26382638

@@ -2939,7 +2939,7 @@ SELECT * FROM ts_token_type('default');
29392939
15 | numhword | Hyphenated word, letters and digits
29402940
16 | asciihword | Hyphenated word, all ASCII
29412941
17 | hword | Hyphenated word, all letters
2942-
18 | uri | URI
2942+
18 | url_path | URL path
29432943
19 | file | File or path name
29442944
20 | float | Decimal notation
29452945
21 | int | Signed integer
@@ -3308,8 +3308,8 @@ Parser: "pg_catalog.default"
33083308
numword | simple
33093309
sfloat | simple
33103310
uint | simple
3311-
uri | simple
33123311
url | simple
3312+
url_path | simple
33133313
version | simple
33143314
word | russian_stem
33153315
</programlisting>
@@ -3398,8 +3398,8 @@ Parser: "pg_catalog.default"
33983398
sfloat | Scientific notation
33993399
tag | HTML tag
34003400
uint | Unsigned integer
3401-
uri | URI
34023401
url | URL
3402+
url_path | URL path
34033403
version | Version number
34043404
word | Word, all letters
34053405
(23 rows)

src/backend/snowball/snowball.sql.in

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- $PostgreSQL: pgsql/src/backend/snowball/snowball.sql.in,v 1.5 2007/10/23 20:46:12 tgl Exp $$
1+
-- $PostgreSQL: pgsql/src/backend/snowball/snowball.sql.in,v 1.6 2007/10/27 16:01:08 tgl Exp $$
22

33
-- text search configuration for _LANGNAME_ language
44
CREATE TEXT SEARCH DICTIONARY _DICTNAME_
@@ -12,8 +12,9 @@ CREATE TEXT SEARCH CONFIGURATION _CFGNAME_
1212
COMMENT ON TEXT SEARCH CONFIGURATION _CFGNAME_ IS 'configuration for _LANGNAME_ language';
1313

1414
ALTER TEXT SEARCH CONFIGURATION _CFGNAME_ ADD MAPPING
15-
FOR email, url, host, sfloat, version, uri, file, float, int, uint,
16-
numword, hword_numpart, numhword
15+
FOR email, url, url_path, host, file, version,
16+
sfloat, float, int, uint,
17+
numword, hword_numpart, numhword
1718
WITH simple;
1819

1920
ALTER TEXT SEARCH CONFIGURATION _CFGNAME_ ADD MAPPING

src/backend/tsearch/wparser_def.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.4 2007/10/23 20:46:12 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/wparser_def.c,v 1.5 2007/10/27 16:01:08 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -41,7 +41,7 @@
4141
#define NUMHWORD 15
4242
#define ASCIIHWORD 16
4343
#define HWORD 17
44-
#define URI 18
44+
#define URLPATH 18
4545
#define FILEPATH 19
4646
#define DECIMAL 20
4747
#define SIGNEDINT 21
@@ -69,7 +69,7 @@ static const char * const tok_alias[] = {
6969
"numhword",
7070
"asciihword",
7171
"hword",
72-
"uri",
72+
"url_path",
7373
"file",
7474
"float",
7575
"int",
@@ -96,7 +96,7 @@ static const char * const lex_descr[] = {
9696
"Hyphenated word, letters and digits",
9797
"Hyphenated word, all ASCII",
9898
"Hyphenated word, all letters",
99-
"URI",
99+
"URL path",
100100
"File or path name",
101101
"Decimal notation",
102102
"Signed integer",
@@ -164,9 +164,9 @@ typedef enum
164164
TPS_InPathSecond,
165165
TPS_InFile,
166166
TPS_InFileNext,
167-
TPS_InURIFirst,
168-
TPS_InURIStart,
169-
TPS_InURI,
167+
TPS_InURLPathFirst,
168+
TPS_InURLPathStart,
169+
TPS_InURLPath,
170170
TPS_InFURL,
171171
TPS_InProtocolFirst,
172172
TPS_InProtocolSecond,
@@ -624,15 +624,15 @@ p_ishost(TParser * prs)
624624
}
625625

626626
static int
627-
p_isURI(TParser * prs)
627+
p_isURLPath(TParser * prs)
628628
{
629629
TParser *tmpprs = TParserInit(prs->str + prs->state->posbyte, prs->lenstr - prs->state->posbyte);
630630
int res = 0;
631631

632632
tmpprs->state = newTParserPosition(tmpprs->state);
633633
tmpprs->state->state = TPS_InFileFirst;
634634

635-
if (TParserGet(tmpprs) && (tmpprs->type == URI || tmpprs->type == FILEPATH))
635+
if (TParserGet(tmpprs) && (tmpprs->type == URLPATH || tmpprs->type == FILEPATH))
636636
{
637637
prs->state->posbyte += tmpprs->lenbytelexeme;
638638
prs->state->poschar += tmpprs->lencharlexeme;
@@ -995,7 +995,7 @@ static TParserStateActionItem actionTPS_InHostDomain[] = {
995995
{p_iseqC, '.', A_PUSH, TPS_InHostFirstDomain, 0, NULL},
996996
{p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
997997
{p_isdigit, 0, A_POP, TPS_Null, 0, NULL},
998-
{p_isstophost, 0, A_BINGO | A_CLRALL, TPS_InURIStart, HOST, NULL},
998+
{p_isstophost, 0, A_BINGO | A_CLRALL, TPS_InURLPathStart, HOST, NULL},
999999
{p_iseqC, '/', A_PUSH, TPS_InFURL, 0, NULL},
10001000
{NULL, 0, A_BINGO | A_CLRALL, TPS_Base, HOST, NULL}
10011001
};
@@ -1009,7 +1009,7 @@ static TParserStateActionItem actionTPS_InPortFirst[] = {
10091009
static TParserStateActionItem actionTPS_InPort[] = {
10101010
{p_isEOF, 0, A_BINGO | A_CLRALL, TPS_Base, HOST, NULL},
10111011
{p_isdigit, 0, A_NEXT, TPS_InPort, 0, NULL},
1012-
{p_isstophost, 0, A_BINGO | A_CLRALL, TPS_InURIStart, HOST, NULL},
1012+
{p_isstophost, 0, A_BINGO | A_CLRALL, TPS_InURLPathStart, HOST, NULL},
10131013
{p_iseqC, '/', A_PUSH, TPS_InFURL, 0, NULL},
10141014
{NULL, 0, A_BINGO | A_CLRALL, TPS_Base, HOST, NULL}
10151015
};
@@ -1042,7 +1042,7 @@ static TParserStateActionItem actionTPS_InFileFirst[] = {
10421042
{p_isdigit, 0, A_NEXT, TPS_InFile, 0, NULL},
10431043
{p_iseqC, '.', A_NEXT, TPS_InPathFirst, 0, NULL},
10441044
{p_iseqC, '_', A_NEXT, TPS_InFile, 0, NULL},
1045-
{p_iseqC, '?', A_PUSH, TPS_InURIFirst, 0, NULL},
1045+
{p_iseqC, '?', A_PUSH, TPS_InURLPathFirst, 0, NULL},
10461046
{p_iseqC, '~', A_PUSH, TPS_InFileTwiddle, 0, NULL},
10471047
{NULL, 0, A_POP, TPS_Null, 0, NULL}
10481048
};
@@ -1089,7 +1089,7 @@ static TParserStateActionItem actionTPS_InFile[] = {
10891089
{p_iseqC, '_', A_NEXT, TPS_InFile, 0, NULL},
10901090
{p_iseqC, '-', A_NEXT, TPS_InFile, 0, NULL},
10911091
{p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
1092-
{p_iseqC, '?', A_PUSH, TPS_InURIFirst, 0, NULL},
1092+
{p_iseqC, '?', A_PUSH, TPS_InURLPathFirst, 0, NULL},
10931093
{NULL, 0, A_BINGO, TPS_Base, FILEPATH, NULL}
10941094
};
10951095

@@ -1101,29 +1101,29 @@ static TParserStateActionItem actionTPS_InFileNext[] = {
11011101
{NULL, 0, A_POP, TPS_Null, 0, NULL}
11021102
};
11031103

1104-
static TParserStateActionItem actionTPS_InURIFirst[] = {
1104+
static TParserStateActionItem actionTPS_InURLPathFirst[] = {
11051105
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
11061106
{p_iseqC, '"', A_POP, TPS_Null, 0, NULL},
11071107
{p_iseqC, '\'', A_POP, TPS_Null, 0, NULL},
1108-
{p_isnotspace, 0, A_CLEAR, TPS_InURI, 0, NULL},
1108+
{p_isnotspace, 0, A_CLEAR, TPS_InURLPath, 0, NULL},
11091109
{NULL, 0, A_POP, TPS_Null, 0, NULL},
11101110
};
11111111

1112-
static TParserStateActionItem actionTPS_InURIStart[] = {
1113-
{NULL, 0, A_NEXT, TPS_InURI, 0, NULL}
1112+
static TParserStateActionItem actionTPS_InURLPathStart[] = {
1113+
{NULL, 0, A_NEXT, TPS_InURLPath, 0, NULL}
11141114
};
11151115

1116-
static TParserStateActionItem actionTPS_InURI[] = {
1117-
{p_isEOF, 0, A_BINGO, TPS_Base, URI, NULL},
1118-
{p_iseqC, '"', A_BINGO, TPS_Base, URI, NULL},
1119-
{p_iseqC, '\'', A_BINGO, TPS_Base, URI, NULL},
1120-
{p_isnotspace, 0, A_NEXT, TPS_InURI, 0, NULL},
1121-
{NULL, 0, A_BINGO, TPS_Base, URI, NULL}
1116+
static TParserStateActionItem actionTPS_InURLPath[] = {
1117+
{p_isEOF, 0, A_BINGO, TPS_Base, URLPATH, NULL},
1118+
{p_iseqC, '"', A_BINGO, TPS_Base, URLPATH, NULL},
1119+
{p_iseqC, '\'', A_BINGO, TPS_Base, URLPATH, NULL},
1120+
{p_isnotspace, 0, A_NEXT, TPS_InURLPath, 0, NULL},
1121+
{NULL, 0, A_BINGO, TPS_Base, URLPATH, NULL}
11221122
};
11231123

11241124
static TParserStateActionItem actionTPS_InFURL[] = {
11251125
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
1126-
{p_isURI, 0, A_BINGO | A_CLRALL, TPS_Base, URL_T, SpecialFURL},
1126+
{p_isURLPath, 0, A_BINGO | A_CLRALL, TPS_Base, URL_T, SpecialFURL},
11271127
{NULL, 0, A_POP, TPS_Null, 0, NULL}
11281128
};
11291129

@@ -1344,9 +1344,9 @@ static const TParserStateAction Actions[] = {
13441344
{TPS_InPathSecond, actionTPS_InPathSecond},
13451345
{TPS_InFile, actionTPS_InFile},
13461346
{TPS_InFileNext, actionTPS_InFileNext},
1347-
{TPS_InURIFirst, actionTPS_InURIFirst},
1348-
{TPS_InURIStart, actionTPS_InURIStart},
1349-
{TPS_InURI, actionTPS_InURI},
1347+
{TPS_InURLPathFirst, actionTPS_InURLPathFirst},
1348+
{TPS_InURLPathStart, actionTPS_InURLPathStart},
1349+
{TPS_InURLPath, actionTPS_InURLPath},
13501350
{TPS_InFURL, actionTPS_InFURL},
13511351
{TPS_InProtocolFirst, actionTPS_InProtocolFirst},
13521352
{TPS_InProtocolSecond, actionTPS_InProtocolSecond},

src/test/regress/expected/tsearch.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ SELECT * FROM ts_token_type('default');
227227
15 | numhword | Hyphenated word, letters and digits
228228
16 | asciihword | Hyphenated word, all ASCII
229229
17 | hword | Hyphenated word, all letters
230-
18 | uri | URI
230+
18 | url_path | URL path
231231
19 | file | File or path name
232232
20 | float | Decimal notation
233233
21 | int | Signed integer

0 commit comments

Comments
 (0)