From the course: Advanced PostgreSQL

Unlock this course with a free trial

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

Using logical operations in search terms

Using logical operations in search terms - PostgreSQL Tutorial

From the course: Advanced PostgreSQL

Using logical operations in search terms

In this movie, let's perform full text search on the table that we have just created. I select star from online courses where the term learn is present in the title of the course. Observe that the query has to be in the tsquery format. That's why I use two tsquery and the title has to be in the tsvector format and that's why I use two tsvector. The double at operator will perform full text search. Go ahead and execute the search and you'll find a number of records in the result. Note that we searched for the term learn and only in the title of the course, but you can see here that the first four titles, Learning Java, Introduction to Machine Learning, Learning Spring Boot and Learning TensorFlow all contain the word learning and not learn. The term learning in its lexeme format is just learn, and because the tsquery and the vector both use the lexeme format that is the root of the word, these records were all correctly matched. Using lexeme allows PostgreSQL to identify the actual…

Contents