Navigation Menu

Skip to content

Commit

Permalink
Support LIKE by pgroonga.text_regexp_ops
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 14, 2015
1 parent 1588555 commit c8cff3f
Show file tree
Hide file tree
Showing 27 changed files with 613 additions and 4 deletions.
20 changes: 20 additions & 0 deletions expected/regexp/text/like/begin-of-text/bitmapscan.out
@@ -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 pgroonga.text_regexp_ops);
SET enable_seqscan = off;
SET enable_indexscan = off;
SET enable_bitmapscan = on;
SELECT id, content
FROM memos
WHERE content LIKE 'Groonga%';
id | content
----+------------------------------------------
2 | Groonga is fast full text search engine.
(1 row)

DROP TABLE memos;
20 changes: 20 additions & 0 deletions expected/regexp/text/like/begin-of-text/indexscan.out
@@ -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 pgroonga.text_regexp_ops);
SET enable_seqscan = off;
SET enable_indexscan = on;
SET enable_bitmapscan = off;
SELECT id, content
FROM memos
WHERE content LIKE 'Groonga%';
id | content
----+------------------------------------------
2 | Groonga is fast full text search engine.
(1 row)

DROP TABLE memos;
20 changes: 20 additions & 0 deletions expected/regexp/text/like/begin-of-text/seqscan.out
@@ -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 pgroonga.text_regexp_ops);
SET enable_seqscan = on;
SET enable_indexscan = off;
SET enable_bitmapscan = off;
SELECT id, content
FROM memos
WHERE content LIKE 'Groonga%';
id | content
----+------------------------------------------
2 | Groonga is fast full text search engine.
(1 row)

DROP TABLE memos;
20 changes: 20 additions & 0 deletions expected/regexp/text/like/end-of-text/bitmapscan.out
@@ -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 pgroonga.text_regexp_ops);
SET enable_seqscan = off;
SET enable_indexscan = off;
SET enable_bitmapscan = on;
SELECT id, content
FROM memos
WHERE content LIKE '%Groonga';
id | content
----+------------------------------------------------------
3 | PGroonga is a PostgreSQL extension that uses Groonga
(1 row)

DROP TABLE memos;
20 changes: 20 additions & 0 deletions expected/regexp/text/like/end-of-text/indexscan.out
@@ -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 pgroonga.text_regexp_ops);
SET enable_seqscan = off;
SET enable_indexscan = on;
SET enable_bitmapscan = off;
SELECT id, content
FROM memos
WHERE content LIKE '%Groonga';
id | content
----+------------------------------------------------------
3 | PGroonga is a PostgreSQL extension that uses Groonga
(1 row)

DROP TABLE memos;
20 changes: 20 additions & 0 deletions expected/regexp/text/like/end-of-text/seqscan.out
@@ -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 pgroonga.text_regexp_ops);
SET enable_seqscan = on;
SET enable_indexscan = off;
SET enable_bitmapscan = off;
SELECT id, content
FROM memos
WHERE content LIKE '%Groonga';
id | content
----+------------------------------------------------------
3 | PGroonga is a PostgreSQL extension that uses Groonga
(1 row)

DROP TABLE memos;
20 changes: 20 additions & 0 deletions expected/regexp/text/like/exact/bitmapscan.out
@@ -0,0 +1,20 @@
CREATE TABLE memos (
id integer,
content text
);
INSERT INTO memos VALUES (1, 'PostgreSQL');
INSERT INTO memos VALUES (2, 'Groonga');
INSERT INTO memos VALUES (3, 'PGroonga');
CREATE INDEX grnindex ON memos USING pgroonga (content pgroonga.text_regexp_ops);
SET enable_seqscan = off;
SET enable_indexscan = off;
SET enable_bitmapscan = on;
SELECT id, content
FROM memos
WHERE content LIKE 'Groonga';
id | content
----+---------
2 | Groonga
(1 row)

DROP TABLE memos;
20 changes: 20 additions & 0 deletions expected/regexp/text/like/exact/indexscan.out
@@ -0,0 +1,20 @@
CREATE TABLE memos (
id integer,
content text
);
INSERT INTO memos VALUES (1, 'PostgreSQL');
INSERT INTO memos VALUES (2, 'Groonga');
INSERT INTO memos VALUES (3, 'PGroonga');
CREATE INDEX grnindex ON memos USING pgroonga (content pgroonga.text_regexp_ops);
SET enable_seqscan = off;
SET enable_indexscan = on;
SET enable_bitmapscan = off;
SELECT id, content
FROM memos
WHERE content LIKE 'Groonga';
id | content
----+---------
2 | Groonga
(1 row)

DROP TABLE memos;
20 changes: 20 additions & 0 deletions expected/regexp/text/like/exact/seqscan.out
@@ -0,0 +1,20 @@
CREATE TABLE memos (
id integer,
content text
);
INSERT INTO memos VALUES (1, 'PostgreSQL');
INSERT INTO memos VALUES (2, 'Groonga');
INSERT INTO memos VALUES (3, 'PGroonga');
CREATE INDEX grnindex ON memos USING pgroonga (content pgroonga.text_regexp_ops);
SET enable_seqscan = on;
SET enable_indexscan = off;
SET enable_bitmapscan = off;
SELECT id, content
FROM memos
WHERE content LIKE 'Groonga';
id | content
----+---------
2 | Groonga
(1 row)

DROP TABLE memos;
21 changes: 21 additions & 0 deletions expected/regexp/text/like/partial/bitmapscan.out
@@ -0,0 +1,21 @@
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 pgroonga.text_regexp_ops);
SET enable_seqscan = off;
SET enable_indexscan = off;
SET enable_bitmapscan = on;
SELECT id, content
FROM memos
WHERE content LIKE '%Groonga%';
id | content
----+-------------------------------------------------------
2 | Groonga is fast full text search engine.
3 | PGroonga is a PostgreSQL extension that uses Groonga.
(2 rows)

DROP TABLE memos;
21 changes: 21 additions & 0 deletions expected/regexp/text/like/partial/indexscan.out
@@ -0,0 +1,21 @@
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 pgroonga.text_regexp_ops);
SET enable_seqscan = off;
SET enable_indexscan = on;
SET enable_bitmapscan = off;
SELECT id, content
FROM memos
WHERE content LIKE '%Groonga%';
id | content
----+-------------------------------------------------------
2 | Groonga is fast full text search engine.
3 | PGroonga is a PostgreSQL extension that uses Groonga.
(2 rows)

DROP TABLE memos;
21 changes: 21 additions & 0 deletions expected/regexp/text/like/partial/seqscan.out
@@ -0,0 +1,21 @@
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 pgroonga.text_regexp_ops);
SET enable_seqscan = on;
SET enable_indexscan = off;
SET enable_bitmapscan = off;
SELECT id, content
FROM memos
WHERE content LIKE '%Groonga%';
id | content
----+-------------------------------------------------------
2 | Groonga is fast full text search engine.
3 | PGroonga is a PostgreSQL extension that uses Groonga.
(2 rows)

DROP TABLE memos;
1 change: 1 addition & 0 deletions pgroonga--0.9.0--1.0.0.sql
Expand Up @@ -40,6 +40,7 @@ CREATE OPERATOR @~ (

CREATE OPERATOR CLASS pgroonga.text_regexp_ops FOR TYPE text
USING pgroonga AS
OPERATOR 6 pg_catalog.~~,
OPERATOR 10 @~;

CREATE OPERATOR CLASS pgroonga.varchar_regexp_ops FOR TYPE varchar
Expand Down

0 comments on commit c8cff3f

Please sign in to comment.