[Groonga-commit] pgroonga/pgroonga at 4038f1c [master] Use "_in" instead of "_contain" for OR values

Back to archive index

Kouhei Sutou null+****@clear*****
Tue May 2 10:25:24 JST 2017


Kouhei Sutou	2017-05-02 10:25:24 +0900 (Tue, 02 May 2017)

  New Revision: 4038f1cc976f801d89c98fb33ce434390c8194be
  https://github.com/pgroonga/pgroonga/commit/4038f1cc976f801d89c98fb33ce434390c8194be

  Message:
    Use "_in" instead of "_contain" for OR values

  Modified files:
    data/pgroonga--1.2.0--1.2.1.sql
    data/pgroonga.sql
    src/pgroonga.c

  Modified: data/pgroonga--1.2.0--1.2.1.sql (+6 -7)
===================================================================
--- data/pgroonga--1.2.0--1.2.1.sql    2017-05-02 10:19:35 +0900 (3444843)
+++ data/pgroonga--1.2.0--1.2.1.sql    2017-05-02 10:25:24 +0900 (3d66a2e)
@@ -99,28 +99,28 @@ CREATE OPERATOR &` (
 	RIGHTARG = text
 );
 
-CREATE FUNCTION pgroonga.match_contain_text_array(text[], text[])
+CREATE FUNCTION pgroonga.match_in_text_array(text[], text[])
 	RETURNS bool
-	AS 'MODULE_PATHNAME', 'pgroonga_match_contain_text_array'
+	AS 'MODULE_PATHNAME', 'pgroonga_match_in_text_array'
 	LANGUAGE C
 	IMMUTABLE
 	STRICT;
 
 CREATE OPERATOR &@> (
-	PROCEDURE = pgroonga.match_contain_text_array,
+	PROCEDURE = pgroonga.match_in_text_array,
 	LEFTARG = text[],
 	RIGHTARG = text[]
 );
 
-CREATE FUNCTION pgroonga.query_contain_text_array(text[], text[])
+CREATE FUNCTION pgroonga.query_in_text_array(text[], text[])
 	RETURNS bool
-	AS 'MODULE_PATHNAME', 'pgroonga_query_contain_text_array'
+	AS 'MODULE_PATHNAME', 'pgroonga_query_in_text_array'
 	LANGUAGE C
 	IMMUTABLE
 	STRICT;
 
 CREATE OPERATOR &?> (
-	PROCEDURE = pgroonga.query_contain_text_array,
+	PROCEDURE = pgroonga.query_in_text_array,
 	LEFTARG = text[],
 	RIGHTARG = text[]
 );
@@ -134,4 +134,3 @@ CREATE OPERATOR CLASS pgroonga.text_array_full_text_search_ops_v2
 		OPERATOR 15 &` (text[], text),
 		OPERATOR 18 &@> (text[], text[]),
 		OPERATOR 19 &?> (text[], text[]);
-

  Modified: data/pgroonga.sql (+12 -12)
===================================================================
--- data/pgroonga.sql    2017-05-02 10:19:35 +0900 (f5c2dfc)
+++ data/pgroonga.sql    2017-05-02 10:25:24 +0900 (ed34f9d)
@@ -409,54 +409,54 @@ CREATE OPERATOR &` (
 	RIGHTARG = text
 );
 
-CREATE FUNCTION pgroonga.match_contain_text(text, text[])
+CREATE FUNCTION pgroonga.match_in_text(text, text[])
 	RETURNS bool
-	AS 'MODULE_PATHNAME', 'pgroonga_match_contain_text'
+	AS 'MODULE_PATHNAME', 'pgroonga_match_in_text'
 	LANGUAGE C
 	IMMUTABLE
 	STRICT;
 
 CREATE OPERATOR &@> (
-	PROCEDURE = pgroonga.match_contain_text,
+	PROCEDURE = pgroonga.match_in_text,
 	LEFTARG = text,
 	RIGHTARG = text[]
 );
 
-CREATE FUNCTION pgroonga.match_contain_text_array(text[], text[])
+CREATE FUNCTION pgroonga.match_in_text_array(text[], text[])
 	RETURNS bool
-	AS 'MODULE_PATHNAME', 'pgroonga_match_contain_text_array'
+	AS 'MODULE_PATHNAME', 'pgroonga_match_in_text_array'
 	LANGUAGE C
 	IMMUTABLE
 	STRICT;
 
 CREATE OPERATOR &@> (
-	PROCEDURE = pgroonga.match_contain_text_array,
+	PROCEDURE = pgroonga.match_in_text_array,
 	LEFTARG = text[],
 	RIGHTARG = text[]
 );
 
-CREATE FUNCTION pgroonga.query_contain_text(text, text[])
+CREATE FUNCTION pgroonga.query_in_text(text, text[])
 	RETURNS bool
-	AS 'MODULE_PATHNAME', 'pgroonga_query_contain_text'
+	AS 'MODULE_PATHNAME', 'pgroonga_query_in_text'
 	LANGUAGE C
 	IMMUTABLE
 	STRICT;
 
 CREATE OPERATOR &?> (
-	PROCEDURE = pgroonga.query_contain_text,
+	PROCEDURE = pgroonga.query_in_text,
 	LEFTARG = text,
 	RIGHTARG = text[]
 );
 
-CREATE FUNCTION pgroonga.query_contain_text_array(text[], text[])
+CREATE FUNCTION pgroonga.query_in_text_array(text[], text[])
 	RETURNS bool
-	AS 'MODULE_PATHNAME', 'pgroonga_query_contain_text_array'
+	AS 'MODULE_PATHNAME', 'pgroonga_query_in_text_array'
 	LANGUAGE C
 	IMMUTABLE
 	STRICT;
 
 CREATE OPERATOR &?> (
-	PROCEDURE = pgroonga.query_contain_text_array,
+	PROCEDURE = pgroonga.query_in_text_array,
 	LEFTARG = text[],
 	RIGHTARG = text[]
 );

  Modified: src/pgroonga.c (+34 -36)
===================================================================
--- src/pgroonga.c    2017-05-02 10:19:35 +0900 (402726b)
+++ src/pgroonga.c    2017-05-02 10:25:24 +0900 (d952dfb)
@@ -195,10 +195,10 @@ PGRN_FUNCTION_INFO_V1(pgroonga_script_text);
 PGRN_FUNCTION_INFO_V1(pgroonga_script_text_array);
 PGRN_FUNCTION_INFO_V1(pgroonga_prefix_text);
 PGRN_FUNCTION_INFO_V1(pgroonga_prefix_rk_text);
-PGRN_FUNCTION_INFO_V1(pgroonga_match_contain_text);
-PGRN_FUNCTION_INFO_V1(pgroonga_match_contain_text_array);
-PGRN_FUNCTION_INFO_V1(pgroonga_query_contain_text);
-PGRN_FUNCTION_INFO_V1(pgroonga_query_contain_text_array);
+PGRN_FUNCTION_INFO_V1(pgroonga_match_in_text);
+PGRN_FUNCTION_INFO_V1(pgroonga_match_in_text_array);
+PGRN_FUNCTION_INFO_V1(pgroonga_query_in_text);
+PGRN_FUNCTION_INFO_V1(pgroonga_query_in_text_array);
 PGRN_FUNCTION_INFO_V1(pgroonga_prefix_text_array);
 PGRN_FUNCTION_INFO_V1(pgroonga_prefix_contain_text_array);
 PGRN_FUNCTION_INFO_V1(pgroonga_prefix_rk_text_array);
@@ -1419,11 +1419,10 @@ pgroonga_execute_binary_operator_text_array(ArrayType *operands1,
 	return false;
 }
 
-/* TODO: "in" will be better than "contain". */
 static bool
-pgroonga_execute_binary_operator_contain_text(text *operand1,
-											  ArrayType *operands2,
-											  PGrnBinaryOperatorTextFunction operator)
+pgroonga_execute_binary_operator_in_text(text *operand1,
+										 ArrayType *operands2,
+										 PGrnBinaryOperatorTextFunction operator)
 {
 	int i, n;
 
@@ -1449,11 +1448,10 @@ pgroonga_execute_binary_operator_contain_text(text *operand1,
 	return false;
 }
 
-/* TODO: "in" will be better than "contain". */
 static bool
-pgroonga_execute_binary_operator_contain_text_array(ArrayType *operands1,
-													ArrayType *operands2,
-													PGrnBinaryOperatorTextFunction operator)
+pgroonga_execute_binary_operator_in_text_array(ArrayType *operands1,
+											   ArrayType *operands2,
+											   PGrnBinaryOperatorTextFunction operator)
 {
 	int i, n;
 
@@ -1469,9 +1467,9 @@ pgroonga_execute_binary_operator_contain_text_array(ArrayType *operands1,
 			continue;
 
 		operand1 = DatumGetTextPP(operandDatum1);
-		if (pgroonga_execute_binary_operator_contain_text(operand1,
-														  operands2,
-														  operator))
+		if (pgroonga_execute_binary_operator_in_text(operand1,
+													 operands2,
+													 operator))
 			return true;
 	}
 
@@ -2075,69 +2073,69 @@ pgroonga_prefix_rk_text(PG_FUNCTION_ARGS)
 }
 
 /**
- * pgroonga.match_contain_text(target text, keywords text[]) : bool
+ * pgroonga.match_in_text(target text, keywords text[]) : bool
  */
 Datum
-pgroonga_match_contain_text(PG_FUNCTION_ARGS)
+pgroonga_match_in_text(PG_FUNCTION_ARGS)
 {
 	text *target = PG_GETARG_TEXT_PP(0);
 	ArrayType *keywords = PG_GETARG_ARRAYTYPE_P(1);
 	bool matched;
 
 	matched =
-		pgroonga_execute_binary_operator_contain_text(target,
-													  keywords,
-													  pgroonga_match_term_raw);
+		pgroonga_execute_binary_operator_in_text(target,
+												 keywords,
+												 pgroonga_match_term_raw);
 	PG_RETURN_BOOL(matched);
 }
 
 /**
- * pgroonga.match_contain_text_array(targets text[], keywords text[]) : bool
+ * pgroonga.match_in_text_array(targets text[], keywords text[]) : bool
  */
 Datum
-pgroonga_match_contain_text_array(PG_FUNCTION_ARGS)
+pgroonga_match_in_text_array(PG_FUNCTION_ARGS)
 {
 	ArrayType *targets = PG_GETARG_ARRAYTYPE_P(0);
 	ArrayType *keywords = PG_GETARG_ARRAYTYPE_P(1);
 	bool matched;
 
 	matched =
-		pgroonga_execute_binary_operator_contain_text_array(targets,
-															keywords,
-															pgroonga_match_term_raw);
+		pgroonga_execute_binary_operator_in_text_array(targets,
+													   keywords,
+													   pgroonga_match_term_raw);
 	PG_RETURN_BOOL(matched);
 }
 
 /**
- * pgroonga.query_contain_text(target text, queries text[]) : bool
+ * pgroonga.query_in_text(target text, queries text[]) : bool
  */
 Datum
-pgroonga_query_contain_text(PG_FUNCTION_ARGS)
+pgroonga_query_in_text(PG_FUNCTION_ARGS)
 {
 	text *target = PG_GETARG_TEXT_PP(0);
 	ArrayType *queries = PG_GETARG_ARRAYTYPE_P(1);
 	grn_bool matched;
 
-	matched = pgroonga_execute_binary_operator_contain_text(target,
-															queries,
-															pgroonga_match_query_raw);
+	matched = pgroonga_execute_binary_operator_in_text(target,
+													   queries,
+													   pgroonga_match_query_raw);
 	PG_RETURN_BOOL(matched);
 }
 
 /**
- * pgroonga.query_contain_text_array(targets text[], queries text[]) : bool
+ * pgroonga.query_in_text_array(targets text[], queries text[]) : bool
  */
 Datum
-pgroonga_query_contain_text_array(PG_FUNCTION_ARGS)
+pgroonga_query_in_text_array(PG_FUNCTION_ARGS)
 {
 	ArrayType *targets = PG_GETARG_ARRAYTYPE_P(0);
 	ArrayType *queries = PG_GETARG_ARRAYTYPE_P(1);
 	bool matched;
 
 	matched =
-		pgroonga_execute_binary_operator_contain_text_array(targets,
-															queries,
-															pgroonga_match_query_raw);
+		pgroonga_execute_binary_operator_in_text_array(targets,
+													   queries,
+													   pgroonga_match_query_raw);
 	PG_RETURN_BOOL(matched);
 }
 
@@ -2194,7 +2192,7 @@ pgroonga_prefix_rk_text_array(PG_FUNCTION_ARGS)
 Datum
 pgroonga_prefix_rk_contain_text_array(PG_FUNCTION_ARGS)
 {
-	return pgroonga_prefix_rk_contain_text_array(fcinfo);
+	return pgroonga_prefix_rk_text_array(fcinfo);
 }
 
 static bool
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-commit mailing list
Back to archive index