89 struct SN_env *(*create) (void);
95 #define STEMMER_MODULE(name,enc,senc) \
96 {#name, enc, name##_##senc##_create_env, name##_##senc##_close_env, name##_##senc##_stem}
158 {NULL, 0, NULL, NULL, NULL}
214 (
errcode(ERRCODE_UNDEFINED_OBJECT),
215 errmsg(
"no Snowball stemmer available for language \"%s\" and encoding \"%s\"",
224 bool stoploaded =
false;
229 foreach(
l, dictoptions)
233 if (strcmp(defel->
defname,
"stopwords") == 0)
237 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
238 errmsg(
"multiple StopWords parameters")));
242 else if (strcmp(defel->
defname,
"language") == 0)
246 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
247 errmsg(
"multiple Language parameters")));
253 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
254 errmsg(
"unrecognized Snowball parameter: \"%s\"",
261 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
262 errmsg(
"missing Language parameter")));
323 if (d->
z->
p && d->
z->
l)
326 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)
char * pg_any_to_server(const char *s, int len, int encoding)
int GetDatabaseEncoding(void)
const char * GetDatabaseEncodingName(void)
char * pg_server_to_any(const char *s, int len, int encoding)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext CurrentMemoryContext
void * repalloc(void *pointer, Size size)
int pg_strcasecmp(const char *s1, const char *s2)
MemoryContextSwitchTo(old_ctx)
int(* stem)(struct SN_env *z)
void(* close)(struct SN_env *)
int(* stem)(struct SN_env *)
struct SN_env *(* create)(void)
char * lowerstr_with_len(const char *str, int len)
char * lowerstr(const char *str)
void readstoplist(const char *fname, StopList *s, char *(*wordop)(const char *))
bool searchstoplist(StopList *s, char *key)