87 #define STEMMER_MODULE(name,enc,senc) \ 88 {#name, enc, name##_##senc##_create_env, name##_##senc##_close_env, name##_##senc##_stem} 142 {NULL, 0, NULL, NULL, NULL}
171 for (m = stemmer_modules; m->
name; m++)
186 for (m = stemmer_modules; m->
name; m++)
198 (
errcode(ERRCODE_UNDEFINED_OBJECT),
199 errmsg(
"no Snowball stemmer available for language \"%s\" and encoding \"%s\"",
208 bool stoploaded =
false;
213 foreach(l, dictoptions)
217 if (strcmp(defel->
defname,
"stopwords") == 0)
221 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
222 errmsg(
"multiple StopWords parameters")));
226 else if (strcmp(defel->
defname,
"language") == 0)
230 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
231 errmsg(
"multiple Language parameters")));
237 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
238 errmsg(
"unrecognized Snowball parameter: \"%s\"",
245 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
246 errmsg(
"missing Language parameter")));
291 if (d->
z->
p && d->
z->
l)
294 memcpy(txt, d->
z->
p, d->
z->
l);
#define PG_RETURN_POINTER(x)
#define PG_GETARG_INT32(n)
#define STEMMER_MODULE(name, enc, senc)
int SN_set_current(struct SN_env *z, int size, const symbol *s)
char * lowerstr_with_len(const char *str, int len)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
int errcode(int sqlerrcode)
#define PG_GETARG_POINTER(n)
char * lowerstr(const char *str)
struct DictSnowball DictSnowball
int(* stem)(struct SN_env *z)
int pg_strcasecmp(const char *s1, const char *s2)
char * pg_server_to_any(const char *s, int len, int encoding)
void pfree(void *pointer)
char * defGetString(DefElem *def)
struct SN_env *(* create)(void)
MemoryContext CurrentMemoryContext
PG_FUNCTION_INFO_V1(dsnowball_init)
#define ereport(elevel, rest)
Datum dsnowball_lexize(PG_FUNCTION_ARGS)
void readstoplist(const char *fname, StopList *s, char *(*wordop)(const char *))
void * palloc0(Size size)
int GetDatabaseEncoding(void)
void(* close)(struct SN_env *)
static void locate_stem_module(DictSnowball *d, const char *lang)
const char * GetDatabaseEncodingName(void)
static const stemmer_module stemmer_modules[]
struct stemmer_module stemmer_module
int(* stem)(struct SN_env *)
void * repalloc(void *pointer, Size size)
bool searchstoplist(StopList *s, char *key)
Datum dsnowball_init(PG_FUNCTION_ARGS)
int errmsg(const char *fmt,...)
char * pg_any_to_server(const char *s, int len, int encoding)