Postgres: What does @@ (double at symbol) mean?
Asked Answered
P

1

7

Recently I've found a piece of code for ruby on rails which should search string like like-operator:

scope :search, -> (query) { where('name @@ :q', q: query) }

But couldn't find any documentation about it.

The operator doesn't work as expected. So what exactly it does?

Porta answered 27/9, 2016 at 12:34 Comment(1)
text search in the columnCapacitor
A
6

It's a text search, check out documentation.

If you'd rather not go somewhere else for an answer, here:

The @@ operator in PostgreSQL is related to the full-text search capabilities provided by the tsquery and tsvector types. The @@ operator is used to compare a tsquery value (the query) with a tsvector value (the document) to determine if the document matches the query.

The tsvector type represents a document processed for full-text search, while the tsquery type represents a query in a format suitable for searching in tsvector documents. The @@ operator returns true if the query matches the document, and false otherwise.

Arrestment answered 27/9, 2016 at 12:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.