@hongminhee there is a tsvector datatype for that https://www.postgresql.org/docs/current/textsearch-intro.html the "best" way certainly depends on your constraint, but i would evaluate that first and see if it doesn't match your need, look for solutions more specific to it.