Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c63c194

Browse files
committed
Optimize. Improve ispell support for compound words. This work was sponsored by ABC Startsiden AS.
1 parent 6a04c57 commit c63c194

File tree

3 files changed

+706
-294
lines changed

3 files changed

+706
-294
lines changed

contrib/tsearch2/dict_ispell.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Datum spell_lexize(PG_FUNCTION_ARGS);
2727
static void
2828
freeDictISpell(DictISpell * d)
2929
{
30-
FreeIspell(&(d->obj));
30+
NIFree(&(d->obj));
3131
freestoplist(&(d->stoplist));
3232
free(d);
3333
}
@@ -71,7 +71,7 @@ spell_init(PG_FUNCTION_ARGS)
7171
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
7272
errmsg("dictionary already loaded")));
7373
}
74-
if (ImportDictionary(&(d->obj), pcfg->value))
74+
if (NIImportDictionary(&(d->obj), pcfg->value))
7575
{
7676
freeDictISpell(d);
7777
ereport(ERROR,
@@ -90,7 +90,7 @@ spell_init(PG_FUNCTION_ARGS)
9090
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
9191
errmsg("affixes already loaded")));
9292
}
93-
if (ImportAffixes(&(d->obj), pcfg->value))
93+
if (NIImportAffixes(&(d->obj), pcfg->value))
9494
{
9595
freeDictISpell(d);
9696
ereport(ERROR,
@@ -132,8 +132,8 @@ spell_init(PG_FUNCTION_ARGS)
132132

133133
if (affloaded && dictloaded)
134134
{
135-
SortDictionary(&(d->obj));
136-
SortAffixes(&(d->obj));
135+
NISortDictionary(&(d->obj));
136+
NISortAffixes(&(d->obj));
137137
}
138138
else if (!affloaded)
139139
{
@@ -168,7 +168,7 @@ spell_lexize(PG_FUNCTION_ARGS)
168168

169169
res = palloc(sizeof(char *) * 2);
170170
txt = pnstrdup(in, PG_GETARG_INT32(2));
171-
res = NormalizeWord(&(d->obj), txt);
171+
res = NINormalizeWord(&(d->obj), txt);
172172
pfree(txt);
173173

174174
if (res == NULL)

0 commit comments

Comments
 (0)