BloGroonga

2016-06-02

PGroonga 1.0.9 has been released

PGroonga (píːzí:lúnɡά) 1.0.9 has been released!

See PGroonga 1.0.0 release announce about PGroonga.

Changes

Here are changes since 1.0.6:

This release adds pgroonga.text_array_term_search_ops_v2 operator class. You can use prefix search and prefix RK search against text[] type with this operator class. They are useful to implement input completion on search text box.

The following description shows how to use prefix search and prefix RK search. The following description uses an example that implements tag name input completion.

First, you need to insert tag names and tag readings. Tag readings should be in Katakana.

CREATE TABLE tags (
  name text PRIMARY KEY,
  readings text[]
);

INSERT INTO tags VALUES ('PostgreSQL', ARRAY['ポストグレスキューエル', 'ポスグレ']);
INSERT INTO tags VALUES ('Groonga',    ARRAY['グルンガ']);
INSERT INTO tags VALUES ('PGroonga',   ARRAY['ピージールンガ']);
INSERT INTO tags VALUES ('pglogical',  ARRAY['ピージーロジカル']);

You need to create indexes against tag names and tag readings. It's important that pgroonga.text_array_term_search_ops_v2 operator class is used for tags.readings.

CREATE INDEX pgroonga_tags_index ON tags
  USING pgroonga (name pgroonga.text_term_search_ops_v2,
                  readings pgroonga.text_array_term_search_ops_v2);

Here is a SELECT to use prefix search against tag names such as PostgreSQL and Groonga:

SELECT name
  FROM tags
  WHERE name &^ 'pos';
--     name    
-- ------------
--  PostgreSQL
-- (1 row)

Here is a SELECT to search tags by romanization of Japanese:

SELECT name, readings
  FROM tags
  WHERE readings &^~> 'pos';
--     name    |             readings              
-- ------------+-----------------------------------
--  PostgreSQL | {ポストグレスキューエル,ポスグレ}
-- (1 row)

You can use OR to get both results:

SELECT name, readings
  FROM tags
  WHERE name &^ 'pos' OR
        readings &^~> 'pos';
--     name    |             readings              
-- ------------+-----------------------------------
--  PostgreSQL | {ポストグレスキューエル,ポスグレ}
-- (1 row)

Here is an example that searches by pi-ji-:

SELECT name, readings
  FROM tags
  WHERE name &^ 'pi-ji-' OR
        readings &^~> 'pi-ji-';
--    name    |      readings      
-- -----------+--------------------
--  PGroonga  | {ピージールンガ}
--  pglogical | {ピージーロジカル}
-- (2 rows)

If you can implement input completion by PostgreSQL, you can use PostgreSQL on more situations.

How to upgrade

This version is compatible with 1.0.6, 1.0.7 and 1.0.8. Upgrade by steps in "Compatible case" in Upgrade document.

Conclusion

New PGroonga version has been released.

Try PGroonga when you want to perform fast full text search against all languages on PostgreSQL!