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

Commit17b0de7

Browse files
author
Artur Zakirov
committed
shared_ispell uses new version of IspellDict struct
1 parent1e78219 commit17b0de7

File tree

4 files changed

+286
-1
lines changed

4 files changed

+286
-1
lines changed

‎contrib/shared_ispell/log/initdb.log

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Running in noclean mode. Mistakes will not be cleaned up.
2+
The files belonging to this database system will be owned by user "artur".
3+
This user must also own the server process.
4+
5+
The database cluster will be initialized with locales
6+
COLLATE: ru_RU.UTF-8
7+
CTYPE: ru_RU.UTF-8
8+
MESSAGES: C
9+
MONETARY: ru_RU.UTF-8
10+
NUMERIC: ru_RU.UTF-8
11+
TIME: ru_RU.UTF-8
12+
The default database encoding has accordingly been set to "UTF8".
13+
The default text search configuration will be set to "russian".
14+
15+
Data page checksums are disabled.
16+
17+
creating directory /home/artur/source/pg/postgrespro/contrib/shared_ispell/./tmp_check/data ... ok
18+
creating subdirectories ... ok
19+
selecting default max_connections ... 100
20+
selecting default shared_buffers ... 128MB
21+
selecting dynamic shared memory implementation ... posix
22+
creating configuration files ... ok
23+
creating template1 database in /home/artur/source/pg/postgrespro/contrib/shared_ispell/./tmp_check/data/base/1 ... ok
24+
initializing pg_authid ... ok
25+
initializing dependencies ... ok
26+
creating system views ... ok
27+
loading system objects' descriptions ... ok
28+
creating collations ... ok
29+
creating conversions ... ok
30+
creating dictionaries ... ok
31+
setting privileges on built-in objects ... ok
32+
creating information schema ... ok
33+
loading PL/pgSQL server-side language ... ok
34+
vacuuming database template1 ... ok
35+
copying template1 to template0 ... ok
36+
copying template1 to postgres ... ok
37+
38+
Sync to disk skipped.
39+
The data directory might become corrupt if the operating system crashes.
40+
41+
WARNING: enabling "trust" authentication for local connections
42+
You can change this by editing pg_hba.conf or using the option -A, or
43+
--auth-local and --auth-host, the next time you run initdb.
44+
45+
Success. You can now start the database server using:
46+
47+
pg_ctl -D /home/artur/source/pg/postgrespro/contrib/shared_ispell/./tmp_check/data -l logfile start
48+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
LOG: database system was shut down at 2016-03-18 17:07:23 MSK
2+
LOG: MultiXact member wraparound protections are now enabled
3+
LOG: database system is ready to accept connections
4+
LOG: autovacuum launcher started
5+
LOG: checkpoint starting: immediate force wait flush-all
6+
LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.000 s, total=0.001 s; sync files=0, longest=0.000 s, average=0.000 s; distance=1 kB, estimate=1 kB
7+
LOG: checkpoint starting: immediate force wait
8+
LOG: checkpoint complete: wrote 0 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 0 recycled; write=0.000 s, sync=0.000 s, total=0.000 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=1 kB
9+
LOG: received fast shutdown request
10+
LOG: aborting any active transactions
11+
LOG: autovacuum launcher shutting down
12+
LOG: shutting down
13+
LOG: checkpoint starting: shutdown immediate
14+
LOG: checkpoint complete: wrote 39 buffers (0.2%); 0 transaction log file(s) added, 0 removed, 0 recycled; write=0.000 s, sync=0.000 s, total=0.000 s; sync files=0, longest=0.000 s, average=0.000 s; distance=118 kB, estimate=118 kB
15+
LOG: database system is shut down
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
CREATE EXTENSION shared_ispell;
2+
-- Test ISpell dictionary with ispell affix file
3+
CREATE TEXT SEARCH DICTIONARY shared_ispell (
4+
Template=shared_ispell,
5+
DictFile=ispell_sample,
6+
AffFile=ispell_sample,
7+
Stopwords=english
8+
);
9+
SELECT ts_lexize('shared_ispell', 'skies');
10+
ts_lexize
11+
-----------
12+
{sky}
13+
(1 row)
14+
15+
SELECT ts_lexize('shared_ispell', 'bookings');
16+
ts_lexize
17+
----------------
18+
{booking,book}
19+
(1 row)
20+
21+
SELECT ts_lexize('shared_ispell', 'booking');
22+
ts_lexize
23+
----------------
24+
{booking,book}
25+
(1 row)
26+
27+
SELECT ts_lexize('shared_ispell', 'foot');
28+
ts_lexize
29+
-----------
30+
{foot}
31+
(1 row)
32+
33+
SELECT ts_lexize('shared_ispell', 'foots');
34+
ts_lexize
35+
-----------
36+
{foot}
37+
(1 row)
38+
39+
SELECT ts_lexize('shared_ispell', 'rebookings');
40+
ts_lexize
41+
----------------
42+
{booking,book}
43+
(1 row)
44+
45+
SELECT ts_lexize('shared_ispell', 'rebooking');
46+
ts_lexize
47+
----------------
48+
{booking,book}
49+
(1 row)
50+
51+
SELECT ts_lexize('shared_ispell', 'unbookings');
52+
ts_lexize
53+
-----------
54+
{book}
55+
(1 row)
56+
57+
SELECT ts_lexize('shared_ispell', 'unbooking');
58+
ts_lexize
59+
-----------
60+
{book}
61+
(1 row)
62+
63+
SELECT ts_lexize('shared_ispell', 'unbook');
64+
ts_lexize
65+
-----------
66+
{book}
67+
(1 row)
68+
69+
SELECT ts_lexize('shared_ispell', 'footklubber');
70+
ts_lexize
71+
----------------
72+
{foot,klubber}
73+
(1 row)
74+
75+
SELECT ts_lexize('shared_ispell', 'footballklubber');
76+
ts_lexize
77+
------------------------------------------------------
78+
{footballklubber,foot,ball,klubber,football,klubber}
79+
(1 row)
80+
81+
SELECT ts_lexize('shared_ispell', 'ballyklubber');
82+
ts_lexize
83+
----------------
84+
{ball,klubber}
85+
(1 row)
86+
87+
SELECT ts_lexize('shared_ispell', 'footballyklubber');
88+
ts_lexize
89+
---------------------
90+
{foot,ball,klubber}
91+
(1 row)
92+
93+
-- Test ISpell dictionary with hunspell affix file
94+
CREATE TEXT SEARCH DICTIONARY shared_hunspell (
95+
Template=shared_ispell,
96+
DictFile=ispell_sample,
97+
AffFile=hunspell_sample
98+
);
99+
SELECT ts_lexize('shared_hunspell', 'skies');
100+
ts_lexize
101+
-----------
102+
{sky}
103+
(1 row)
104+
105+
SELECT ts_lexize('shared_hunspell', 'bookings');
106+
ts_lexize
107+
----------------
108+
{booking,book}
109+
(1 row)
110+
111+
SELECT ts_lexize('shared_hunspell', 'booking');
112+
ts_lexize
113+
----------------
114+
{booking,book}
115+
(1 row)
116+
117+
SELECT ts_lexize('shared_hunspell', 'foot');
118+
ts_lexize
119+
-----------
120+
{foot}
121+
(1 row)
122+
123+
SELECT ts_lexize('shared_hunspell', 'foots');
124+
ts_lexize
125+
-----------
126+
{foot}
127+
(1 row)
128+
129+
SELECT ts_lexize('shared_hunspell', 'rebookings');
130+
ts_lexize
131+
----------------
132+
{booking,book}
133+
(1 row)
134+
135+
SELECT ts_lexize('shared_hunspell', 'rebooking');
136+
ts_lexize
137+
----------------
138+
{booking,book}
139+
(1 row)
140+
141+
SELECT ts_lexize('shared_hunspell', 'unbookings');
142+
ts_lexize
143+
-----------
144+
{book}
145+
(1 row)
146+
147+
SELECT ts_lexize('shared_hunspell', 'unbooking');
148+
ts_lexize
149+
-----------
150+
{book}
151+
(1 row)
152+
153+
SELECT ts_lexize('shared_hunspell', 'unbook');
154+
ts_lexize
155+
-----------
156+
{book}
157+
(1 row)
158+
159+
SELECT ts_lexize('shared_hunspell', 'footklubber');
160+
ts_lexize
161+
----------------
162+
{foot,klubber}
163+
(1 row)
164+
165+
SELECT ts_lexize('shared_hunspell', 'footballklubber');
166+
ts_lexize
167+
------------------------------------------------------
168+
{footballklubber,foot,ball,klubber,football,klubber}
169+
(1 row)
170+
171+
SELECT ts_lexize('shared_hunspell', 'ballyklubber');
172+
ts_lexize
173+
----------------
174+
{ball,klubber}
175+
(1 row)
176+
177+
SELECT ts_lexize('shared_hunspell', 'footballyklubber');
178+
ts_lexize
179+
---------------------
180+
{foot,ball,klubber}
181+
(1 row)
182+
183+
SELECT dict_name, affix_name, words, affixes FROM shared_ispell_dicts();
184+
dict_name | affix_name | words | affixes
185+
---------------+-----------------+-------+---------
186+
ispell_sample | hunspell_sample | 8 | 7
187+
ispell_sample | ispell_sample | 8 | 7
188+
(2 rows)
189+
190+
SELECT stop_name, words FROM shared_ispell_stoplists();
191+
stop_name | words
192+
-----------+-------
193+
english | 127
194+
(1 row)
195+
196+
SELECT shared_ispell_reset();
197+
shared_ispell_reset
198+
---------------------
199+
200+
(1 row)
201+
202+
SELECT ts_lexize('shared_ispell', 'skies');
203+
ts_lexize
204+
-----------
205+
{sky}
206+
(1 row)
207+
208+
SELECT ts_lexize('shared_hunspell', 'skies');
209+
ts_lexize
210+
-----------
211+
{sky}
212+
(1 row)
213+

‎contrib/shared_ispell/src/shared_ispell.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ clean_dict_affix(IspellDict *dict)
264264
dict->nAffixData=0;
265265

266266
dict->CompoundAffix=NULL;
267+
dict->CompoundAffixFlags=NULL;
268+
dict->nCompoundAffixFlag=0;
269+
dict->mCompoundAffixFlag=0;
267270

268271
dict->avail=0;
269272
}
@@ -315,7 +318,13 @@ init_shared_dict(DictInfo *info, char *dictFile, char *affFile, char *stopFile)
315318
NIImportDictionary(dict,get_tsearch_config_filename(dictFile,"dict"));
316319

317320
dict->usecompound=info->dict.usecompound;
318-
memcpy(dict->flagval,&(info->dict.flagval),65000);
321+
322+
dict->nCompoundAffixFlag=dict->mCompoundAffixFlag=
323+
info->dict.nCompoundAffixFlag;
324+
dict->CompoundAffixFlags= (CompoundAffixFlag*)palloc0(
325+
dict->nCompoundAffixFlag*sizeof(CompoundAffixFlag));
326+
memcpy(dict->CompoundAffixFlags,info->dict.CompoundAffixFlags,
327+
dict->nCompoundAffixFlag*sizeof(CompoundAffixFlag));
319328

320329
/*
321330
* If affix->useFlagAliases == true then AffixData is generated

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp