Loading topic
to_tsvector, to_tsquery and the @@ operator. It explains the argument that appeared first in each of those calls: the text search configuration. Choosing it correctly decides which words match, which rows can be indexed, and wh4 min readpsql, and that you have read the earlier chapters on why LIKE falls short and on text search configurations. It covers what a tsvector contains, how PostgreSQL builds one, and which details later affect matching and ranking.4 min readtsquery is the query half of PostgreSQL full-text search. It stores search terms as normalized lexemes and joins them with operators. This chapter assumes you know the tsvector type from the previous chapters and can run queries in psql. You should also know that a text search configuration 4 min readtsvector and tsquery values. You should know that to_tsvector turns text into lexemes with positions and that to_tsquery builds a query from lexemes and operators. Here you will use the @@ operator that join4 min readto_tsvector turns text into lexemes, and have seen to_tsquery and the @@ operator. It covers how to feed text typed by a user into a search query without errors or surprises.4 min readtsvector and a tsquery and match them with @@. It covers the <-> and <N> operators, how phrase queries behave around stop words and punctuation, and how to approximate "within N words" matching.4 min readtsvector with to_tsvector, build a tsquery, and match them with @@. It also assumes you have seen the articles table with a stored search column. Here you will make a title match count for more than a body match.4 min readtsvector, write a tsquery, and match with @@. It also assumes you know how setweight labels lexemes with A to D. If any of that is unfamiliar, review those chapters first. The articles table with its weighted search column and GIN index is the4 min readarticles table from the earlier chapters. That means a stored, weighted search column with a GIN index on it, and you know how @@ and ts_rank work. Basic SQL and psql are enough for everything else.4 min readtsvector with to_tsvector, apply setweight, and match with @@. You should also know how to create tables and indexes in PostgreSQL. Here we move the tsvector out of the query and into the table, so it is computed once at write time instead of on4 min readtsvector in a generated column and match it with @@, as the earlier chapters show. Here you add a GIN index so those matches stop scanning every row. You will also see what the index stores, how to confirm the planner uses it, and what it cos4 min readsearch column and the GIN index on articles from the previous chapters. You should also be comfortable reading EXPLAIN output. GIN is the usual choice for full-text search. GiST is the other index type that can serve @@ queries, and it behaves quite4 min readtsvector and tsquery. You should be comfortable with to_tsvector, ts_debug and ALTER TEXT SEARCH CONFIGURATION. Here you will look at what a configuration does with each token: it hands the token to a chain of d5 min readtsvector and a tsquery are, and have read the chapters on text search configurations and dictionaries. It also assumes you have the articles table with a generated search column and a GIN index.5 min readto_tsvector, to_tsquery and @@. It also assumes you know what a stored tsvector column and a GIN index are. Most full-text search problems fall into three groups: a term that does not match, a corpus with unexpected vocabulary, 5 min readpostgre does not find postgres, because the stemmer produces two different lexemes. This chapter covers the pg_trgm extension, which scores how similar two strings are and so tolerates typos. It assumes you know tsvector, tsquery, @@4 min readtsvector column, query it with @@, rank with ts_rank, and read an EXPLAIN plan. Built-in full-text search covers a lot of ground. This chapter lists where it stops and gives criteria for adding pg_trgm or a dedica5 min read