mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Improve support of multibyte encoding:
- tsvector_(in|out) - tsquery_(in|out) - to_tsvector - to_tsquery, plainto_tsquery - 'simple' dictionary
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "spell.h"
|
||||
#include "ts_locale.h"
|
||||
|
||||
#define MAX_NORM 1024
|
||||
#define MAXNORMLEN 256
|
||||
@ -30,18 +31,6 @@ cmpspellaffix(const void *s1, const void *s2)
|
||||
return (strcmp(((const SPELL *) s1)->p.flag, ((const SPELL *) s2)->p.flag));
|
||||
}
|
||||
|
||||
static void
|
||||
strlower(char *str)
|
||||
{
|
||||
unsigned char *ptr = (unsigned char *) str;
|
||||
|
||||
while (*ptr)
|
||||
{
|
||||
*ptr = tolower(*ptr);
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
strnduplicate(char *s, int len)
|
||||
{
|
||||
@ -175,7 +164,7 @@ NIImportDictionary(IspellDict * Conf, const char *filename)
|
||||
}
|
||||
else
|
||||
flag = "";
|
||||
strlower(str);
|
||||
lowerstr(str);
|
||||
/* Dont load words if first letter is not required */
|
||||
/* It allows to optimize loading at search time */
|
||||
s = str;
|
||||
@ -385,7 +374,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
|
||||
*s = 0;
|
||||
if (!*str)
|
||||
continue;
|
||||
strlower(str);
|
||||
lowerstr(str);
|
||||
strcpy(mask, "");
|
||||
strcpy(find, "");
|
||||
strcpy(repl, "");
|
||||
@ -851,7 +840,7 @@ NormalizeSubWord(IspellDict * Conf, char *word, char flag)
|
||||
|
||||
if (wrdlen > MAXNORMLEN)
|
||||
return NULL;
|
||||
strlower(word);
|
||||
lowerstr(word);
|
||||
cur = forms = (char **) palloc(MAX_NORM * sizeof(char *));
|
||||
*cur = NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user