So I've been working with sequelize
for a while now, and after juggling with elasticsearch
, I decided to make use of postgres's
support for fts
.
It looks like just at the start of this year sequelize
added support for TSVector
which is necessary for FTS
implementation. Although I just can't find any documentation whatsover anywhere.
All help is appreciated!
If you look at changes for the PR you will see new operator Op.match
and the new data type DateTypes.TSVECTOR
.
You can now define a field like this in a model:
...
textField: {
type: DataTypes.TSVECTOR
}
...
And you simply can use it like this in where
option:
textField: {
[Op.match]: Sequelize.fn('to_tsquery', 'fat & rat') // match text search for strings 'fat' and 'rat' (PG only)
}
See this readme