[Groonga-commit] pgroonga/pgroonga at 7a65b4f [master] Fix a bug that "AND" doesn't work

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Jan 22 20:51:22 JST 2015


Kouhei Sutou	2015-01-22 20:51:22 +0900 (Thu, 22 Jan 2015)

  New Revision: 7a65b4f115099fa6694a0b72293f69d60f827e08
  https://github.com/pgroonga/pgroonga/commit/7a65b4f115099fa6694a0b72293f69d60f827e08

  Message:
    Fix a bug that "AND" doesn't work
    
    Reported by judgeOX. Thanks!!!

  Added files:
    expected/text/single/and/bitmapscan.out
    expected/text/single/and/indexscan.out
    expected/text/single/and/seqscan.out
    sql/text/single/and/bitmapscan.sql
    sql/text/single/and/indexscan.sql
    sql/text/single/and/seqscan.sql
  Modified files:
    pgroonga.c

  Added: expected/text/single/and/bitmapscan.out (+20 -0) 100644
===================================================================
--- /dev/null
+++ expected/text/single/and/bitmapscan.out    2015-01-22 20:51:22 +0900 (18902ee)
@@ -0,0 +1,20 @@
+CREATE TABLE memos (
+  id integer,
+  content text
+);
+INSERT INTO memos VALUES (1, 'PostgreSQL is a RDBMS.');
+INSERT INTO memos VALUES (2, 'Groonga is fast full text search engine.');
+INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga.');
+CREATE INDEX grnindex ON memos USING pgroonga (content);
+SET enable_seqscan = off;
+SET enable_indexscan = off;
+SET enable_bitmapscan = on;
+SELECT id, content
+  FROM memos
+ WHERE content %% 'PGroonga' AND content %% 'Groonga';
+ id |                        content                        
+----+-------------------------------------------------------
+  3 | PGroonga is a PostgreSQL extension that uses Groonga.
+(1 row)
+
+DROP TABLE memos;

  Added: expected/text/single/and/indexscan.out (+20 -0) 100644
===================================================================
--- /dev/null
+++ expected/text/single/and/indexscan.out    2015-01-22 20:51:22 +0900 (2340ca8)
@@ -0,0 +1,20 @@
+CREATE TABLE memos (
+  id integer,
+  content text
+);
+INSERT INTO memos VALUES (1, 'PostgreSQL is a RDBMS.');
+INSERT INTO memos VALUES (2, 'Groonga is fast full text search engine.');
+INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga.');
+CREATE INDEX grnindex ON memos USING pgroonga (content);
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = off;
+SELECT id, content
+  FROM memos
+ WHERE content %% 'PGroonga' AND content %% 'Groonga';
+ id |                        content                        
+----+-------------------------------------------------------
+  3 | PGroonga is a PostgreSQL extension that uses Groonga.
+(1 row)
+
+DROP TABLE memos;

  Added: expected/text/single/and/seqscan.out (+20 -0) 100644
===================================================================
--- /dev/null
+++ expected/text/single/and/seqscan.out    2015-01-22 20:51:22 +0900 (945b133)
@@ -0,0 +1,20 @@
+CREATE TABLE memos (
+  id integer,
+  content text
+);
+INSERT INTO memos VALUES (1, 'PostgreSQL is a RDBMS.');
+INSERT INTO memos VALUES (2, 'Groonga is fast full text search engine.');
+INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga.');
+CREATE INDEX grnindex ON memos USING pgroonga (content);
+SET enable_seqscan = on;
+SET enable_indexscan = off;
+SET enable_bitmapscan = off;
+SELECT id, content
+  FROM memos
+ WHERE content %% 'PGroonga' AND content %% 'Groonga';
+ id |                        content                        
+----+-------------------------------------------------------
+  3 | PGroonga is a PostgreSQL extension that uses Groonga.
+(1 row)
+
+DROP TABLE memos;

  Modified: pgroonga.c (+1 -1)
===================================================================
--- pgroonga.c    2015-01-19 12:13:05 +0900 (273b4a7)
+++ pgroonga.c    2015-01-22 20:51:22 +0900 (f5e52ce)
@@ -666,7 +666,7 @@ GrnSearch(IndexScanDesc scan)
 		GrnGetValue(index, key->sk_attno - 1, &buffer, key->sk_argument);
 
 		grn_expr_append_obj(ctx, expression, matchTarget, GRN_OP_PUSH, 1);
-		grn_expr_append_obj(ctx, expression, &buffer, GRN_OP_PUSH, 1);
+		grn_expr_append_const(ctx, expression, &buffer, GRN_OP_PUSH, 1);
 
 		switch (key->sk_strategy)
 		{

  Added: sql/text/single/and/bitmapscan.sql (+20 -0) 100644
===================================================================
--- /dev/null
+++ sql/text/single/and/bitmapscan.sql    2015-01-22 20:51:22 +0900 (146c197)
@@ -0,0 +1,20 @@
+CREATE TABLE memos (
+  id integer,
+  content text
+);
+
+INSERT INTO memos VALUES (1, 'PostgreSQL is a RDBMS.');
+INSERT INTO memos VALUES (2, 'Groonga is fast full text search engine.');
+INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga.');
+
+CREATE INDEX grnindex ON memos USING pgroonga (content);
+
+SET enable_seqscan = off;
+SET enable_indexscan = off;
+SET enable_bitmapscan = on;
+
+SELECT id, content
+  FROM memos
+ WHERE content %% 'PGroonga' AND content %% 'Groonga';
+
+DROP TABLE memos;

  Added: sql/text/single/and/indexscan.sql (+20 -0) 100644
===================================================================
--- /dev/null
+++ sql/text/single/and/indexscan.sql    2015-01-22 20:51:22 +0900 (029c121)
@@ -0,0 +1,20 @@
+CREATE TABLE memos (
+  id integer,
+  content text
+);
+
+INSERT INTO memos VALUES (1, 'PostgreSQL is a RDBMS.');
+INSERT INTO memos VALUES (2, 'Groonga is fast full text search engine.');
+INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga.');
+
+CREATE INDEX grnindex ON memos USING pgroonga (content);
+
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = off;
+
+SELECT id, content
+  FROM memos
+ WHERE content %% 'PGroonga' AND content %% 'Groonga';
+
+DROP TABLE memos;

  Added: sql/text/single/and/seqscan.sql (+20 -0) 100644
===================================================================
--- /dev/null
+++ sql/text/single/and/seqscan.sql    2015-01-22 20:51:22 +0900 (9181c68)
@@ -0,0 +1,20 @@
+CREATE TABLE memos (
+  id integer,
+  content text
+);
+
+INSERT INTO memos VALUES (1, 'PostgreSQL is a RDBMS.');
+INSERT INTO memos VALUES (2, 'Groonga is fast full text search engine.');
+INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga.');
+
+CREATE INDEX grnindex ON memos USING pgroonga (content);
+
+SET enable_seqscan = on;
+SET enable_indexscan = off;
+SET enable_bitmapscan = off;
+
+SELECT id, content
+  FROM memos
+ WHERE content %% 'PGroonga' AND content %% 'Groonga';
+
+DROP TABLE memos;
-------------- next part --------------
HTML����������������������������...
Download 



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