title: PostgreSQL: to_tsquery starts with and ends with search
body: <p>Recently, I implemented a PostgreSQL 11 full-text search on a huge table I have in a system to solve the problem of hitting <code>LIKE</code> queries in it. This table has over 200 million rows and querying using <code>to_tsquery</code> worked pretty well for the column of type <code>tsvector</code>.</p>
  <p>Now I need to hit the following queries but reading the documentation I couldn't find how to do it (or it's there and I didn't understand because full-text search is something new to me yet)</p>
  <ul>
  <li>Starts with</li>
  <li>Ends with</li>
  </ul>
  <p>How can I make the query below return true only if the query is &quot;The cat&quot; (starts with) and &quot;the book&quot; (ends with), if it's possible in full-text search.</p>
  <pre><code>select to_tsvector('The cat is on the book') @@ to_tsquery('Cat')
  </code></pre>