komainu8
null+****@clear*****
Tue Jun 27 09:31:00 JST 2017
komainu8 2017-06-27 09:31:00 +0900 (Tue, 27 Jun 2017) New Revision: 4f25895775d5bdd6fcd38932987f5ef87ec15874 https://github.com/pgroonga/pgroonga/commit/4f25895775d5bdd6fcd38932987f5ef87ec15874 Message: Add query expand command. (#44) Add query expand command skeleton Patch by komainu8. Thanks!!! Added files: expected/function/query-expand/one.out sql/function/query-expand/one.sql Modified files: data/pgroonga.sql src/pgroonga.c Modified: data/pgroonga.sql (+7 -0) =================================================================== --- data/pgroonga.sql 2017-06-25 23:19:53 +0900 (725b0cb) +++ data/pgroonga.sql 2017-06-27 09:31:00 +0900 (da28757) @@ -2,6 +2,13 @@ SET search_path = public; CREATE SCHEMA pgroonga; +CREATE FUNCTION pgroonga.query_expand(term text) + RETURNS text + AS 'MODULE_PATHNAME', 'pgroonga_query_expand' + LANGUAGE C + STABLE + STRICT; + CREATE FUNCTION pgroonga.score("row" record) RETURNS float8 AS 'MODULE_PATHNAME', 'pgroonga_score' Added: expected/function/query-expand/one.out (+6 -0) 100644 =================================================================== --- /dev/null +++ expected/function/query-expand/one.out 2017-06-27 09:31:00 +0900 (133ef0e) @@ -0,0 +1,6 @@ +SELECT pgroonga.query_expand('Groonga'); + query_expand +-------------- + Groonga +(1 row) + Added: sql/function/query-expand/one.sql (+1 -0) 100644 =================================================================== --- /dev/null +++ sql/function/query-expand/one.sql 2017-06-27 09:31:00 +0900 (dd08c3f) @@ -0,0 +1 @@ +SELECT pgroonga.query_expand('Groonga'); Modified: src/pgroonga.c (+11 -0) =================================================================== --- src/pgroonga.c 2017-06-25 23:19:53 +0900 (a404034) +++ src/pgroonga.c 2017-06-27 09:31:00 +0900 (699c6c5) @@ -140,6 +140,7 @@ extern PGDLLEXPORT void _PG_init(void); PGRN_FUNCTION_INFO_V1(pgroonga_score); PGRN_FUNCTION_INFO_V1(pgroonga_table_name); PGRN_FUNCTION_INFO_V1(pgroonga_command); +PGRN_FUNCTION_INFO_V1(pgroonga_query_expand); /* * Naming conversions: @@ -1225,6 +1226,16 @@ PGrnCollectScore(Relation table, HeapTuple tuple) return score; } +/** +* pgroonga.query_expand(term text) : text +*/ +Datum +pgroonga_query_expand(PG_FUNCTION_ARGS) +{ + text *term = PG_GETARG_TEXT_PP(0); + + PG_RETURN_TEXT_P(term); +} /** * pgroonga.score(row record) : float8 -------------- next part -------------- HTML����������������������������... Download