15#include "catalog/pg_collation_d.h"
91 struct SN_env *(*create) (void);
97#define STEMMER_MODULE(name,enc,senc) \
98 {#name, enc, name##_##senc##_create_env, name##_##senc##_close_env, name##_##senc##_stem}
160 {NULL, 0, NULL, NULL, NULL}
216 (
errcode(ERRCODE_UNDEFINED_OBJECT),
217 errmsg(
"no Snowball stemmer available for language \"%s\" and encoding \"%s\"",
226 bool stoploaded =
false;
231 foreach(
l, dictoptions)
235 if (strcmp(defel->
defname,
"stopwords") == 0)
239 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
240 errmsg(
"multiple StopWords parameters")));
244 else if (strcmp(defel->
defname,
"language") == 0)
248 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
249 errmsg(
"multiple Language parameters")));
255 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
256 errmsg(
"unrecognized Snowball parameter: \"%s\"",
263 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
264 errmsg(
"missing Language parameter")));
325 if (d->
z->
p && d->
z->
l)
328 memcpy(txt, d->
z->
p, d->
z->
l);
int SN_set_current(struct SN_env *z, int size, const symbol *s)
static void PGresult * res
char * defGetString(DefElem *def)
struct stemmer_module stemmer_module
Datum dsnowball_lexize(PG_FUNCTION_ARGS)
static const stemmer_module stemmer_modules[]
static void locate_stem_module(DictSnowball *d, const char *lang)
#define STEMMER_MODULE(name, enc, senc)
PG_FUNCTION_INFO_V1(dsnowball_init)
Datum dsnowball_init(PG_FUNCTION_ARGS)
struct DictSnowball DictSnowball
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define PG_GETARG_POINTER(n)
#define PG_GETARG_INT32(n)
#define PG_RETURN_POINTER(x)
int GetDatabaseEncoding(void)
char * pg_any_to_server(const char *s, int len, int encoding)
const char * GetDatabaseEncodingName(void)
char * pg_server_to_any(const char *s, int len, int encoding)
void * repalloc(void *pointer, Size size)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext CurrentMemoryContext
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
int pg_strcasecmp(const char *s1, const char *s2)
int(* stem)(struct SN_env *z)
struct SN_env *(* create)(void)
void(* close)(struct SN_env *)
int(* stem)(struct SN_env *)
void readstoplist(const char *fname, StopList *s, char *(*wordop)(const char *, size_t, Oid))
bool searchstoplist(StopList *s, char *key)