*/
#include "postgres.h"
-#include "funcapi.h"
-#include "access/genam.h"
-#include "access/heapam.h"
-#include "access/skey.h"
-#include "catalog/indexing.h"
-#include "catalog/namespace.h"
-#include "catalog/pg_ts_dict.h"
#include "catalog/pg_type.h"
#include "tsearch/ts_cache.h"
-#include "tsearch/ts_public.h"
#include "tsearch/ts_utils.h"
-#include "utils/array.h"
#include "utils/builtins.h"
-#include "utils/fmgroids.h"
-#include "utils/rel.h"
-#include "utils/syscache.h"
/*
* Lexize one word by dictionary, mostly debug function
*/
-static ArrayType *
-ts_lexize_workhorse(Oid dictId, text *in)
+Datum
+ts_lexize(PG_FUNCTION_ARGS)
{
+ Oid dictId = PG_GETARG_OID(0);
+ text *in = PG_GETARG_TEXT_P(1);
+ ArrayType *a;
TSDictionaryCacheEntry *dict;
TSLexeme *res,
*ptr;
Datum *da;
- ArrayType *a;
DictSubState dstate = {false, false, NULL};
dict = lookup_ts_dictionary_cache(dictId);
}
if (!res)
- return NULL;
+ PG_RETURN_NULL();
ptr = res;
while (ptr->lexeme)
ptr++;
- da = (Datum *) palloc(sizeof(Datum) * (ptr - res + 1));
+ da = (Datum *) palloc(sizeof(Datum) * (ptr - res));
ptr = res;
while (ptr->lexeme)
{
pfree(res);
pfree(da);
- return a;
-}
-
-Datum
-ts_lexize_byid(PG_FUNCTION_ARGS)
-{
- Oid dictId = PG_GETARG_OID(0);
- text *in = PG_GETARG_TEXT_P(1);
- ArrayType *a;
-
- a = ts_lexize_workhorse(dictId, in);
-
- if (a)
- PG_RETURN_POINTER(a);
- else
- PG_RETURN_NULL();
-}
-
-Datum
-ts_lexize_byname(PG_FUNCTION_ARGS)
-{
- text *dictname = PG_GETARG_TEXT_P(0);
- text *in = PG_GETARG_TEXT_P(1);
- Oid dictId;
- ArrayType *a;
-
- dictId = TSDictionaryGetDictid(textToQualifiedNameList(dictname), false);
- a = ts_lexize_workhorse(dictId, in);
-
- if (a)
- PG_RETURN_POINTER(a);
- else
- PG_RETURN_NULL();
+ PG_RETURN_POINTER(a);
}
DATA(insert OID = 3721 ( prsd_lextype PGNSP PGUID 12 1 0 f f t f i 1 2281 "2281" _null_ _null_ _null_ prsd_lextype - _null_ _null_ ));
DESCR("");
-DATA(insert OID = 3723 ( ts_lexize PGNSP PGUID 12 1 0 f f t f i 2 1009 "26 25" _null_ _null_ _null_ ts_lexize_byid - _null_ _null_ ));
-DESCR("normalize one word by dictionary");
-DATA(insert OID = 3724 ( ts_lexize PGNSP PGUID 12 1 0 f f t f s 2 1009 "25 25" _null_ _null_ _null_ ts_lexize_byname - _null_ _null_ ));
+DATA(insert OID = 3723 ( ts_lexize PGNSP PGUID 12 1 0 f f t f i 2 1009 "3769 25" _null_ _null_ _null_ ts_lexize - _null_ _null_ ));
DESCR("normalize one word by dictionary");
DATA(insert OID = 3725 ( dsimple_init PGNSP PGUID 12 1 0 f f t f i 1 2281 "2281" _null_ _null_ _null_ dsimple_init - _null_ _null_ ));