21
votes

Read Query

In Posgres, Full text indexing allows documents to be preprocessed and an index saved for later rapid searching. Preprocessing includes:

  • Parsing documents into tokens.

  • Converting tokens into lexemes.

  • Storing preprocessed documents optimized for searching.


tsvector type is used in Postgres for full text search

tsvector type is different than text type in below aspects:

  • Eliminates case. Upper/lower case letter are identical

  • Removes stop words ( and, or, not, she, him, and hundreds of others)-because these words are not relevant for text search

  • Replaces synonyms and takes word stems (elephant -> eleph). In the full text catalogue, it does not have the word elephant but the word elep.

  • Can (and should) be indexed with GIST and GIN

  • Custom ranking with weights & ts_rank


How Elastic search(search engine) has advantage over full text search in Postgres?

1

1 Answers

11
votes

fulltext search and elasticsearch are both built on the same basic technology inverted indices so performance is going to be about the same.

FTS is going to be easier to deploy.

ES comes with lucene,

if you want lucene with FTS that will require extra effort.