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

Commit84ad031

Browse files
committed
Proper handling of stop words (separately from dict/affix files). Added ability to reset the segment with shared_ispell_reset() function, easier to get info about the memory usage with shared_ispell_mem_used() and shared_ispell_mem_available().
1 parentccd9ef0 commit84ad031

File tree

4 files changed

+288
-72
lines changed

4 files changed

+288
-72
lines changed

‎README

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,19 @@ the shared segment. This is a hard limit, the shared segment is not
5151
extensible and you need to set it so that all the dictionaries fit
5252
into it and not much memory is wasted.
5353

54-
Set it higher than you need, load all the dictionaries and check the
55-
log - after loading each dictionary, there's a LOG message with info
56-
about how much memory is available. Use that to tweak the GUC.
54+
To find out how much memory you actually need, use a large value
55+
(e.g. 200MB) and load all the dictionaries you want to use. Then use
56+
the shared_ispell_mem_used() function to find out how much memory
57+
was actually used (and set the max_size GUC variable accordingly).
58+
59+
Don't set it exactly to that value, leave there some free space,
60+
so that you can reload the dictionaries without changing the GUC
61+
max_size limit (which requires a restart of the DB). Ssomething
62+
like 512kB should be just fine.
5763

5864
The shared segment can contain several dictionaries at the same time,
59-
the amount of memory is the only limit.
65+
the amount of memory is the only limit. There's no limit on number
66+
of dictionaries / words etc. Just the max_size GUC variable.
6067

6168

6269
Using the dictionary
@@ -84,3 +91,16 @@ and then do the usual stuff, e.g.
8491
SELECT ts_lexize('czech_shared', 'automobile');
8592

8693
or whatever you want.
94+
95+
96+
Resetting the dictionary
97+
------------------------
98+
If you need to reset the dictionary (e.g. so that you can reload the
99+
updated files from disk), use shared_ispell_reset() function. Eveyone
100+
who already uses the dictionaries will be forced to reinitialize the
101+
data (first one will rebuild the dictionary in shared segment, the
102+
other ones will use this).
103+
104+
SELECT shared_ispell_reset();
105+
106+
That's all for now ...

‎sql/shared_ispell--1.0.0.sql

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
1-
CREATE OR REPLACEFUNCTIONshared_dispell_init(internal)
1+
CREATE OR REPLACEFUNCTIONshared_ispell_init(internal)
22
RETURNS internal
33
AS'MODULE_PATHNAME','dispell_init'
44
LANGUAGE C IMMUTABLE;
55

6-
CREATE OR REPLACEFUNCTIONshared_dispell_lexize(internal,internal,internal,internal)
6+
CREATE OR REPLACEFUNCTIONshared_ispell_lexize(internal,internal,internal,internal)
77
RETURNS internal
88
AS'MODULE_PATHNAME','dispell_lexize'
99
LANGUAGE C IMMUTABLE;
1010

11+
CREATE OR REPLACEFUNCTIONshared_ispell_reset()
12+
RETURNS void
13+
AS'MODULE_PATHNAME','dispell_reset'
14+
LANGUAGE C IMMUTABLE;
15+
16+
CREATE OR REPLACEFUNCTIONshared_ispell_mem_used()
17+
RETURNSinteger
18+
AS'MODULE_PATHNAME','dispell_mem_used'
19+
LANGUAGE C IMMUTABLE;
20+
21+
CREATE OR REPLACEFUNCTIONshared_ispell_mem_available()
22+
RETURNSinteger
23+
AS'MODULE_PATHNAME','dispell_mem_available'
24+
LANGUAGE C IMMUTABLE;
25+
1126
CREATETEXT SEARCH TEMPLATE shared_ispell (
12-
INIT=shared_dispell_init,
13-
LEXIZE=shared_dispell_lexize
27+
INIT=shared_ispell_init,
28+
LEXIZE=shared_ispell_lexize
1429
);
1530

31+
/*
1632
CREATE TEXT SEARCH DICTIONARY czech_shared (
1733
TEMPLATE = shared_ispell,
1834
DictFile = czech,
@@ -26,3 +42,4 @@ ALTER TEXT SEARCH CONFIGURATION czech_shared
2642
ALTER MAPPING FOR asciiword, asciihword, hword_asciipart,
2743
word, hword, hword_part
2844
WITH czech_shared;
45+
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp