To enable phrase search, a field must be indexed with record of position.

Basic Usage

Searches for a specific phrase. Phrases must be wrapped inside double quotes. The following query finds all documents with the word plastic followed immediately by keyboard.

SELECT description, rating, category
FROM mock_items
WHERE description @@@ '"plastic keyboard"';

Slop Operator

The ~ slop operator allows for other words to come in between words in the query phrase. For instance, the following query finds documents containing the word ergonomic followed by keyboard, allowing for a maximum of one word in between.

SELECT description, rating, category
FROM mock_items
WHERE description @@@ '"ergonomic keyboard"~1';

Phrase Prefix

The * prefix operator allows for the last term in the phrase query to be the prefix of another word. For instance, "plastic keyb"* matches plastic keyboard.

SELECT description, rating, category
FROM mock_items
WHERE description @@@ '"plastic keyb"*';

Special Characters

The special characters + , ^, `, :, {, }, ", [, ], (, ), <, >, ~, !, \\, and \* must be escaped by a \ inside the query term.