This is a document for PGroonga 1.X. See PGroonga 2.x document when you're using recent PGroonga.
These were dropped in PGroonga 4.0.0. Not available in PGroonga 4.0.0 or later.
&^ operatorSince 1.2.1.
&^> operator for text[] is deprecated since 1.2.1. Use &^ operator instead.
&^ operator performs prefix search.
Prefix search is useful for implementing input completion.
column &^ prefix
column is a column to be searched. It's text type or text[] type.
prefix is a prefix to be found. It's text type.
The operator returns true when the column value starts with prefix.
You need to specify one of the following operator classes to use this operator:
pgroonga.text_term_search_ops_v2: For text
pgroonga.text_array_term_search_ops_v2: For text[]
Here are sample schema and data for examples:
CREATE TABLE tags (
name text PRIMARY KEY
);
CREATE INDEX pgroonga_tag_name_index ON tags
USING pgroonga (name pgroonga.text_term_search_ops_v2);
INSERT INTO tags VALUES ('PostgreSQL');
INSERT INTO tags VALUES ('Groonga');
INSERT INTO tags VALUES ('PGroonga');
INSERT INTO tags VALUES ('pglogical');
You can perform prefix search with prefix by &^ operator:
SELECT * FROM tags WHERE name &^ 'pg';
-- name
-- -----------
-- PGroonga
-- pglogical
-- (2 rows)
&^~ operator: Prefix RK search
&^| operator: Prefix search by an array of prefixes
&^~| operator: Prefix RK search by an array of prefixes