PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "catalog/namespace.h"
#include "commands/defrem.h"
#include "tsearch/ts_cache.h"
#include "tsearch/ts_locale.h"
#include "tsearch/ts_public.h"
#include "utils/fmgrprotos.h"
#include "utils/regproc.h"
Go to the source code of this file.
Data Structures | |
struct | LexemeInfo |
struct | TheLexeme |
struct | TheSubstitute |
struct | DictThesaurus |
Macros | |
#define | DT_USEASIS 0x1000 |
#define | TR_WAITLEX 1 |
#define | TR_INLEX 2 |
#define | TR_WAITSUBS 3 |
#define | TR_INSUBS 4 |
Typedefs | |
typedef struct LexemeInfo | LexemeInfo |
Functions | |
static void | newLexeme (DictThesaurus *d, char *b, char *e, uint32 idsubst, uint16 posinsubst) |
static void | addWrd (DictThesaurus *d, char *b, char *e, uint32 idsubst, uint16 nwrd, uint16 posinsubst, bool useasis) |
static void | thesaurusRead (const char *filename, DictThesaurus *d) |
static TheLexeme * | addCompiledLexeme (TheLexeme *newwrds, int *nnw, int *tnm, TSLexeme *lexeme, LexemeInfo *src, uint16 tnvariant) |
static int | cmpLexemeInfo (LexemeInfo *a, LexemeInfo *b) |
static int | cmpLexeme (const TheLexeme *a, const TheLexeme *b) |
static int | cmpLexemeQ (const void *a, const void *b) |
static int | cmpTheLexeme (const void *a, const void *b) |
static void | compileTheLexeme (DictThesaurus *d) |
static void | compileTheSubstitute (DictThesaurus *d) |
Datum | thesaurus_init (PG_FUNCTION_ARGS) |
static LexemeInfo * | findTheLexeme (DictThesaurus *d, char *lexeme) |
static bool | matchIdSubst (LexemeInfo *stored, uint32 idsubst) |
static LexemeInfo * | findVariant (LexemeInfo *in, LexemeInfo *stored, uint16 curpos, LexemeInfo **newin, int newn) |
static TSLexeme * | copyTSLexeme (TheSubstitute *ts) |
static TSLexeme * | checkMatch (DictThesaurus *d, LexemeInfo *info, uint16 curpos, bool *moreres) |
Datum | thesaurus_lexize (PG_FUNCTION_ARGS) |
#define DT_USEASIS 0x1000 |
Definition at line 28 of file dict_thesaurus.c.
#define TR_INLEX 2 |
Definition at line 163 of file dict_thesaurus.c.
#define TR_INSUBS 4 |
Definition at line 165 of file dict_thesaurus.c.
#define TR_WAITLEX 1 |
Definition at line 162 of file dict_thesaurus.c.
#define TR_WAITSUBS 3 |
Definition at line 164 of file dict_thesaurus.c.
typedef struct LexemeInfo LexemeInfo |
|
static |
Definition at line 303 of file dict_thesaurus.c.
References TheLexeme::entries, LexemeInfo::idsubst, TheLexeme::lexeme, TSLexeme::lexeme, LexemeInfo::nextentry, palloc(), LexemeInfo::posinsubst, pstrdup(), repalloc(), and LexemeInfo::tnvariant.
Referenced by compileTheLexeme().
|
static |
Definition at line 106 of file dict_thesaurus.c.
References b, DT_USEASIS, TSLexeme::flags, LexemeInfo::idsubst, TheSubstitute::lastlexeme, TSLexeme::lexeme, DictThesaurus::nsubst, TSLexeme::nvariant, palloc(), LexemeInfo::posinsubst, repalloc(), TheSubstitute::res, and DictThesaurus::subst.
Referenced by thesaurusRead().
|
static |
Definition at line 771 of file dict_thesaurus.c.
References Assert, copyTSLexeme(), LexemeInfo::idsubst, TheSubstitute::lastlexeme, LexemeInfo::nextvariant, DictThesaurus::nsubst, and DictThesaurus::subst.
Referenced by thesaurus_lexize().
Definition at line 356 of file dict_thesaurus.c.
Referenced by cmpLexemeQ(), cmpTheLexeme(), and compileTheLexeme().
|
static |
Definition at line 334 of file dict_thesaurus.c.
Referenced by cmpTheLexeme(), and compileTheLexeme().
|
static |
Definition at line 372 of file dict_thesaurus.c.
References a, b, and cmpLexeme().
Referenced by findTheLexeme().
|
static |
Definition at line 378 of file dict_thesaurus.c.
References a, b, cmpLexeme(), cmpLexemeInfo(), TheLexeme::entries, and res.
Referenced by compileTheLexeme().
|
static |
Definition at line 391 of file dict_thesaurus.c.
References addCompiledLexeme(), cmpLexeme(), cmpLexemeInfo(), cmpTheLexeme(), DatumGetPointer(), TSDictionaryCacheEntry::dictData, TheLexeme::entries, ereport, errcode(), errhint(), errmsg(), ERROR, FunctionCall4, i, LexemeInfo::idsubst, Int32GetDatum(), TheLexeme::lexeme, TSLexeme::lexeme, TSDictionaryCacheEntry::lexize, LexemeInfo::nextentry, DictThesaurus::ntwrds, TSLexeme::nvariant, DictThesaurus::nwrds, palloc(), pfree(), PointerGetDatum(), qsort, repalloc(), DictThesaurus::subdict, and DictThesaurus::wrds.
Referenced by thesaurus_init().
|
static |
Definition at line 502 of file dict_thesaurus.c.
References DatumGetPointer(), TSDictionaryCacheEntry::dictData, DT_USEASIS, ereport, errcode(), errmsg(), ERROR, TSLexeme::flags, FunctionCall4, i, Int32GetDatum(), TSLexeme::lexeme, TSDictionaryCacheEntry::lexize, DictThesaurus::nsubst, palloc(), pfree(), PointerGetDatum(), pstrdup(), repalloc(), TheSubstitute::res, TheSubstitute::reslen, DictThesaurus::subdict, DictThesaurus::subst, and TSL_ADDPOS.
Referenced by thesaurus_init().
|
static |
Definition at line 753 of file dict_thesaurus.c.
References i, TSLexeme::lexeme, palloc(), pstrdup(), res, TheSubstitute::res, and TheSubstitute::reslen.
Referenced by checkMatch().
|
static |
Definition at line 657 of file dict_thesaurus.c.
References cmpLexemeQ(), sort-test::key, DictThesaurus::nwrds, res, and DictThesaurus::wrds.
Referenced by thesaurus_lexize().
|
static |
Definition at line 696 of file dict_thesaurus.c.
References i, LexemeInfo::idsubst, matchIdSubst(), LexemeInfo::nextentry, LexemeInfo::nextvariant, LexemeInfo::posinsubst, and LexemeInfo::tnvariant.
Referenced by thesaurus_lexize().
|
static |
Definition at line 676 of file dict_thesaurus.c.
References LexemeInfo::idsubst, LexemeInfo::nextvariant, and res.
Referenced by findVariant().
|
static |
Definition at line 72 of file dict_thesaurus.c.
References b, TheLexeme::entries, LexemeInfo::idsubst, TheLexeme::lexeme, LexemeInfo::nextentry, DictThesaurus::ntwrds, DictThesaurus::nwrds, palloc(), LexemeInfo::posinsubst, repalloc(), and DictThesaurus::wrds.
Referenced by thesaurusRead().
Datum thesaurus_init | ( | PG_FUNCTION_ARGS | ) |
Definition at line 596 of file dict_thesaurus.c.
References compileTheLexeme(), compileTheSubstitute(), defGetString(), DefElem::defname, ereport, errcode(), errmsg(), ERROR, get_ts_dict_oid(), lfirst, lookup_ts_dictionary_cache(), palloc0(), PG_GETARG_POINTER, PG_RETURN_POINTER, pstrdup(), stringToQualifiedNameList(), DictThesaurus::subdict, DictThesaurus::subdictOid, and thesaurusRead().
Datum thesaurus_lexize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 788 of file dict_thesaurus.c.
References checkMatch(), DatumGetPointer(), TSDictionaryCacheEntry::dictData, elog, ERROR, findTheLexeme(), findVariant(), FunctionCall4, DictSubState::getnext, i, if(), DictSubState::isend, TSDictionaryCacheEntry::isvalid, TSLexeme::lexeme, TSDictionaryCacheEntry::lexize, lookup_ts_dictionary_cache(), TSLexeme::nvariant, palloc(), pfree(), PG_GETARG_DATUM, PG_GETARG_POINTER, PG_NARGS, PG_RETURN_POINTER, PointerGetDatum(), LexemeInfo::posinsubst, DictSubState::private_state, res, DictThesaurus::subdict, and DictThesaurus::subdictOid.
|
static |
Definition at line 168 of file dict_thesaurus.c.
References addWrd(), elog, ereport, errcode(), errmsg(), ERROR, filename, get_tsearch_config_filename(), LexemeInfo::idsubst, newLexeme(), DictThesaurus::nsubst, pfree(), pg_mblen(), LexemeInfo::posinsubst, t_iseq, t_isspace(), TR_INLEX, TR_INSUBS, TR_WAITLEX, TR_WAITSUBS, tsearch_readline(), tsearch_readline_begin(), and tsearch_readline_end().
Referenced by thesaurus_init().