Kouhei Sutou
null+****@clear*****
Sun Jan 18 23:25:10 JST 2015
Kouhei Sutou 2015-01-18 23:25:10 +0900 (Sun, 18 Jan 2015) New Revision: a34d79fd885854390cc55ca3024d465f5c99a7fe https://github.com/pgroonga/pgroonga/commit/a34d79fd885854390cc55ca3024d465f5c99a7fe Message: Add tests for multiple text index Added files: expected/text/multiple/contain/bitmapscan.out expected/text/multiple/contain/indexscan.out expected/text/multiple/contain/seqscan.out expected/text/multiple/update.out sql/text/multiple/contain/bitmapscan.sql sql/text/multiple/contain/indexscan.sql sql/text/multiple/contain/seqscan.sql sql/text/multiple/update.sql Modified files: Makefile Modified: Makefile (+3 -0) =================================================================== --- Makefile 2015-01-18 23:15:53 +0900 (9d92488) +++ Makefile 2015-01-18 23:25:10 +0900 (da8d3a3) @@ -19,6 +19,9 @@ PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) installcheck: results/text/single/contain +installcheck: results/text/multiple/contain results/text/single/contain: @mkdir -p results/text/single/contain +results/text/multiple/contain: + @mkdir -p results/text/multiple/contain Added: expected/text/multiple/contain/bitmapscan.out (+25 -0) 100644 =================================================================== --- /dev/null +++ expected/text/multiple/contain/bitmapscan.out 2015-01-18 23:25:10 +0900 (d680f3d) @@ -0,0 +1,25 @@ +CREATE TABLE memos ( + id integer, + title text, + 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 (title, content); +SET enable_seqscan = off; +SET enable_indexscan = off; +SET enable_bitmapscan = on; +SELECT id, title, content + FROM memos + WHERE title %% 'Groonga' OR content %% 'Groonga'; + id | title | content +----+----------+---------------------------------------------- + 2 | Groonga | is fast full text search engine. + 3 | PGroonga | is a PostgreSQL extension that uses Groonga. +(2 rows) + +DROP TABLE memos; Added: expected/text/multiple/contain/indexscan.out (+25 -0) 100644 =================================================================== --- /dev/null +++ expected/text/multiple/contain/indexscan.out 2015-01-18 23:25:10 +0900 (e9f88fe) @@ -0,0 +1,25 @@ +CREATE TABLE memos ( + id integer, + title text, + 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 (title, content); +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; +SELECT id, title, content + FROM memos + WHERE title %% 'Groonga' OR content %% 'Groonga'; + id | title | content +----+----------+---------------------------------------------- + 2 | Groonga | is fast full text search engine. + 3 | PGroonga | is a PostgreSQL extension that uses Groonga. +(2 rows) + +DROP TABLE memos; Added: expected/text/multiple/contain/seqscan.out (+25 -0) 100644 =================================================================== --- /dev/null +++ expected/text/multiple/contain/seqscan.out 2015-01-18 23:25:10 +0900 (d204be7) @@ -0,0 +1,25 @@ +CREATE TABLE memos ( + id integer, + title text, + 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 (title, content); +SET enable_seqscan = on; +SET enable_indexscan = off; +SET enable_bitmapscan = off; +SELECT id, title, content + FROM memos + WHERE title %% 'Groonga' OR content %% 'Groonga'; + id | title | content +----+----------+---------------------------------------------- + 2 | Groonga | is fast full text search engine. + 3 | PGroonga | is a PostgreSQL extension that uses Groonga. +(2 rows) + +DROP TABLE memos; Added: expected/text/multiple/update.out (+37 -0) 100644 =================================================================== --- /dev/null +++ expected/text/multiple/update.out 2015-01-18 23:25:10 +0900 (165ad21) @@ -0,0 +1,37 @@ +CREATE TABLE memos ( + id integer, + title text, + 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 (title, content); +UPDATE memos + SET title = 'Mroonga', + content = 'is a MySQL plugin that uses Groonga.' + WHERE id = 3; +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; +SELECT id, title, content + FROM memos + WHERE title %% 'Groonga' OR content %% 'Groonga'; + id | title | content +----+---------+-------------------------------------- + 2 | Groonga | is fast full text search engine. + 3 | Mroonga | is a MySQL plugin that uses Groonga. +(2 rows) + +SELECT id, title, content + FROM memos + WHERE title %% 'Mroonga' AND content %% 'MySQL'; + id | title | content +----+---------+-------------------------------------- + 3 | Mroonga | is a MySQL plugin that uses Groonga. +(1 row) + +DROP TABLE memos; Added: sql/text/multiple/contain/bitmapscan.sql (+24 -0) 100644 =================================================================== --- /dev/null +++ sql/text/multiple/contain/bitmapscan.sql 2015-01-18 23:25:10 +0900 (6513f31) @@ -0,0 +1,24 @@ +CREATE TABLE memos ( + id integer, + title text, + 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 (title, content); + +SET enable_seqscan = off; +SET enable_indexscan = off; +SET enable_bitmapscan = on; + +SELECT id, title, content + FROM memos + WHERE title %% 'Groonga' OR content %% 'Groonga'; + +DROP TABLE memos; Added: sql/text/multiple/contain/indexscan.sql (+24 -0) 100644 =================================================================== --- /dev/null +++ sql/text/multiple/contain/indexscan.sql 2015-01-18 23:25:10 +0900 (6d2f133) @@ -0,0 +1,24 @@ +CREATE TABLE memos ( + id integer, + title text, + 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 (title, content); + +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; + +SELECT id, title, content + FROM memos + WHERE title %% 'Groonga' OR content %% 'Groonga'; + +DROP TABLE memos; Added: sql/text/multiple/contain/seqscan.sql (+24 -0) 100644 =================================================================== --- /dev/null +++ sql/text/multiple/contain/seqscan.sql 2015-01-18 23:25:10 +0900 (af71b93) @@ -0,0 +1,24 @@ +CREATE TABLE memos ( + id integer, + title text, + 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 (title, content); + +SET enable_seqscan = on; +SET enable_indexscan = off; +SET enable_bitmapscan = off; + +SELECT id, title, content + FROM memos + WHERE title %% 'Groonga' OR content %% 'Groonga'; + +DROP TABLE memos; Added: sql/text/multiple/update.sql (+33 -0) 100644 =================================================================== --- /dev/null +++ sql/text/multiple/update.sql 2015-01-18 23:25:10 +0900 (f4f5163) @@ -0,0 +1,33 @@ +CREATE TABLE memos ( + id integer, + title text, + 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 (title, content); + +UPDATE memos + SET title = 'Mroonga', + content = 'is a MySQL plugin that uses Groonga.' + WHERE id = 3; + +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; + +SELECT id, title, content + FROM memos + WHERE title %% 'Groonga' OR content %% 'Groonga'; + +SELECT id, title, content + FROM memos + WHERE title %% 'Mroonga' AND content %% 'MySQL'; + +DROP TABLE memos; -------------- next part -------------- HTML����������������������������...Download