This is a document for PGroonga 2.X. See PGroonga 1.x document when you're using old PGroonga.

!&^| operator

Since 2.2.1.


!&^| operator performs NOT prefix search by an array of prefixes. If one or more prefixes are matched, the record is NOT matched.


column !&^| prefixes

column is a column to be searched. It's text type.

prefixes is an array of prefixes to be found. It's text[] type.

The operator returns true when the column value doesn't start with any prefixes in prefixes.

Operator classes

You need to specify one of the following operator classes to use this operator:


Here are sample schema and data for examples:

  name text PRIMARY KEY,
  alias text

CREATE INDEX pgroonga_tag_alias_index ON tags
  USING pgroonga (alias pgroonga_text_term_search_ops_v2);
INSERT INTO tags VALUES ('PostgreSQL', 'PG');
INSERT INTO tags VALUES ('Groonga',    'grn');
INSERT INTO tags VALUES ('PGroonga',   'pgrn');
INSERT INTO tags VALUES ('Mroonga',    'mrn');

You can perform NOT prefix search with prefixes by !&^| operator:

SELECT * FROM tags WHERE alias !&^| ARRAY['pg', 'mrn'];
--     name    | alias 
-- ------------+-------
--  Groonga | grn
-- (1 row)

See also