&@ operator

Since 1.2.0.

Summary

&@ operator performs full text search by one keyword.

Syntax

column &@ keyword

column is a column to be searched. It's text type, text[] type or varchar type.

keyword is a keyword for full text search. It's text type for text type or text[] type column. It's varchar type for varchar type column.

Operator classes

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

Usage

Here are sample schema and data for examples:

CREATE TABLE memos (
  id integer,
  content text
);

CREATE INDEX pgroonga_content_index ON memos USING pgroonga (content);
INSERT INTO memos VALUES (1, 'PostgreSQL is a relational database management system.');
INSERT INTO memos VALUES (2, 'Groonga is a fast full text search engine that supports all languages.');
INSERT INTO memos VALUES (3, 'PGroonga is a PostgreSQL extension that uses Groonga as index.');
INSERT INTO memos VALUES (4, 'There is groonga command.');

You can perform full text search with one keyword by &@ operator:

SELECT * FROM memos WHERE content &@ 'engine';
--  id |                                content                                 
-- ----+------------------------------------------------------------------------
--   2 | Groonga is a fast full text search engine that supports all languages.
-- (1 row)

If you want to perform full text search with multiple keywords or AND/OR search, use &? operator.

If you want to perform full text search with multiple keywords OR search, use &@| operator.

See also