Navigation Menu

Skip to content

Commit

Permalink
Add tests for multiple text index
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 18, 2015
1 parent e1e4f00 commit a34d79f
Show file tree
Hide file tree
Showing 9 changed files with 220 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -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
25 changes: 25 additions & 0 deletions expected/text/multiple/contain/bitmapscan.out
@@ -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;
25 changes: 25 additions & 0 deletions expected/text/multiple/contain/indexscan.out
@@ -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;
25 changes: 25 additions & 0 deletions expected/text/multiple/contain/seqscan.out
@@ -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;
37 changes: 37 additions & 0 deletions expected/text/multiple/update.out
@@ -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;
24 changes: 24 additions & 0 deletions sql/text/multiple/contain/bitmapscan.sql
@@ -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;
24 changes: 24 additions & 0 deletions sql/text/multiple/contain/indexscan.sql
@@ -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;
24 changes: 24 additions & 0 deletions sql/text/multiple/contain/seqscan.sql
@@ -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;
33 changes: 33 additions & 0 deletions sql/text/multiple/update.sql
@@ -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;

0 comments on commit a34d79f

Please sign in to comment.