Skip to content

Commit cfd0ba5

Browse files
committed
Merge branch 'PGPRO_shared_ispell' into PGPRO9_5
2 parents b3aede4 + 31d5c10 commit cfd0ba5

File tree

9 files changed

+414
-190
lines changed

9 files changed

+414
-190
lines changed

contrib/hunspell_nl_nl/dict/nl_nl.dict

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137886,10 +137886,6 @@ procureursgeneraal/Fw
137886137886
in-vitro/CeCxC1C2C3C4C5
137887137887
waterkering/CAZbC0
137888137888
huisvester/CxCcC0
137889-
Oost\/Watergraafsmeer
137890-
km\/h
137891-
km\/u
137892-
m\/s
137893137889
Palmzondag
137894137890
palmzondag/Fw
137895137891
ballingsoort/Fw

contrib/shared_ispell/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,20 @@ use this prepared data).
133133
db=# SELECT shared_ispell_reset();
134134

135135
That's all for now ...
136+
137+
Changes from original version
138+
-----------------------------
139+
The original version of this module located in the Tomas Vondra's
140+
[GitHub](https://github.com/tvondra/shared_ispell). That version does not handle
141+
affixes that require full regular expressions (regex_t, implemented in regex.h).
142+
143+
This version of the module can handle that affixes with full regular
144+
exressions. To handle it the module loads and stores affix files in each
145+
sessions. The affix list is tiny and takes a little time and memory to parse.
146+
Actually this is Tomas
147+
[idea](http://www.postgresql.org/message-id/56A5F3D5.9030702@2ndquadrant.com),
148+
but there is not related code in the GitHub.
149+
150+
Author
151+
------
152+
Tomas Vondra [GitHub](https://github.com/tvondra)

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

src/backend/tsearch/Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ include $(top_builddir)/src/Makefile.global
1414

1515
DICTDIR=tsearch_data
1616

17-
DICTFILES=dicts/synonym_sample.syn dicts/thesaurus_sample.ths \
18-
dicts/hunspell_sample.affix dicts/ispell_sample.affix dicts/ispell_sample.dict \
19-
dicts/hunspell_sample_long.affix dicts/hunspell_sample_long.dict \
20-
dicts/hunspell_sample_num.affix dicts/hunspell_sample_num.dict
17+
# List of dictionaries files
18+
DICTFILES=synonym_sample.syn thesaurus_sample.ths \
19+
hunspell_sample.affix \
20+
ispell_sample.affix ispell_sample.dict \
21+
hunspell_sample_long.affix hunspell_sample_long.dict \
22+
hunspell_sample_num.affix hunspell_sample_num.dict
23+
24+
# Local paths to dictionaries files
25+
DICTFILES_PATH=$(addprefix dicts/,$(DICTFILES))
2126

2227
OBJS = ts_locale.o ts_parse.o wparser.o wparser_def.o dict.o \
2328
dict_simple.o dict_synonym.o dict_thesaurus.o \
@@ -27,8 +32,8 @@ OBJS = ts_locale.o ts_parse.o wparser.o wparser_def.o dict.o \
2732
include $(top_srcdir)/src/backend/common.mk
2833

2934
.PHONY: install-data
30-
install-data: $(DICTFILES) installdirs
31-
$(INSTALL_DATA) $(addprefix $(srcdir)/,$(DICTFILES)) '$(DESTDIR)$(datadir)/$(DICTDIR)/'
35+
install-data: $(DICTFILES_PATH) installdirs
36+
$(INSTALL_DATA) $(addprefix $(srcdir)/,$(DICTFILES_PATH)) '$(DESTDIR)$(datadir)/$(DICTDIR)/'
3237

3338
installdirs:
3439
$(MKDIR_P) '$(DESTDIR)$(datadir)' '$(DESTDIR)$(datadir)/$(DICTDIR)'

src/backend/tsearch/dicts/hunspell_sample.affix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ SFX A Y IES [^AEIOU]Y
2121

2222
SFX \ N 1
2323
SFX \ 0 Y/L [^Y]
24-

src/backend/tsearch/dicts/hunspell_sample_long.affix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ SFX sA Y IES [^AEIOU]Y
3232

3333
SFX s\ N 1
3434
SFX s\ 0 Y/2 [^Y]
35-

src/backend/tsearch/dicts/hunspell_sample_num.affix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ SFX 304 Y IES [^AEIOU]Y
2323

2424
SFX 305 N 1
2525
SFX 305 0 Y/102 [^Y]
26-

0 commit comments

Comments
 (0)