[Groonga-commit] pgroonga/pgroonga at 2ea7e02 [master] test: add a test for text primary key

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Jul 28 22:54:18 JST 2017


Kouhei Sutou	2017-07-28 22:54:18 +0900 (Fri, 28 Jul 2017)

  New Revision: 2ea7e02e6c6acbde7e50e756765d714767be9af2
  https://github.com/pgroonga/pgroonga/commit/2ea7e02e6c6acbde7e50e756765d714767be9af2

  Message:
    test: add a test for text primary key

  Added files:
    expected/full-text-search/text/single/score/primary-key/text.out
    sql/full-text-search/text/single/score/primary-key/text.sql

  Added: expected/full-text-search/text/single/score/primary-key/text.out (+23 -0) 100644
===================================================================
--- /dev/null
+++ expected/full-text-search/text/single/score/primary-key/text.out    2017-07-28 22:54:18 +0900 (80fda48)
@@ -0,0 +1,23 @@
+CREATE TABLE memos (
+  id text PRIMARY KEY,
+  content text
+);
+CREATE INDEX pgroonga_index ON memos
+ USING pgroonga (id pgroonga.text_term_search_ops_v2,
+                 content);
+INSERT INTO memos VALUES ('a', 'PostgreSQL is a RDBMS.');
+INSERT INTO memos VALUES ('b', 'Groonga is fast full text search engine.');
+INSERT INTO memos VALUES ('c', 'PGroonga is a PostgreSQL extension that uses Groonga.');
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = off;
+SELECT id, content, pgroonga.score(memos)
+  FROM memos
+ WHERE content &@~ 'PGroonga OR Groonga';
+ id |                        content                        | score 
+----+-------------------------------------------------------+-------
+ c  | PGroonga is a PostgreSQL extension that uses Groonga. |     2
+ b  | Groonga is fast full text search engine.              |     1
+(2 rows)
+
+DROP TABLE memos;

  Added: sql/full-text-search/text/single/score/primary-key/text.sql (+22 -0) 100644
===================================================================
--- /dev/null
+++ sql/full-text-search/text/single/score/primary-key/text.sql    2017-07-28 22:54:18 +0900 (c864084)
@@ -0,0 +1,22 @@
+CREATE TABLE memos (
+  id text PRIMARY KEY,
+  content text
+);
+
+CREATE INDEX pgroonga_index ON memos
+ USING pgroonga (id pgroonga.text_term_search_ops_v2,
+                 content);
+
+INSERT INTO memos VALUES ('a', 'PostgreSQL is a RDBMS.');
+INSERT INTO memos VALUES ('b', 'Groonga is fast full text search engine.');
+INSERT INTO memos VALUES ('c', 'PGroonga is a PostgreSQL extension that uses Groonga.');
+
+SET enable_seqscan = off;
+SET enable_indexscan = on;
+SET enable_bitmapscan = off;
+
+SELECT id, content, pgroonga.score(memos)
+  FROM memos
+ WHERE content &@~ 'PGroonga OR Groonga';
+
+DROP TABLE memos;
-------------- next part --------------
HTML����������������������������...
Télécharger 



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