From the course: Advanced PostgreSQL

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Performing a full-text search using the @@ operator

Performing a full-text search using the @@ operator - PostgreSQL Tutorial

From the course: Advanced PostgreSQL

Performing a full-text search using the @@ operator

You perform full text search in PostgreSQL using the double at operator. This operator allows you to match a query against a document and returns either true or false. True if the query is present. False if it is not. So you can specify the tsquery, then the double operator and then the tsvector or the other way round. tsvector first, then the double at and then the tsquery. Let's take a look at a simple query here. I search for the terms machine and learning represented using the tsquery format, and then I have the double at operator and I search for these terms within the document build and train simple machine learning models represented as a tsvector. That's what the colon colon tsquery, colon, colon, tsvector stands for. That will actually convert our query and vector into the tsquery and tsvector format respectively. When you execute this query, you'll get the result true. That's because the terms machine and learning are indeed present in our document. I'll now change the query…

Contents