Thanks, the function idea is a good one. It makes the query look a lot better.
My next question is are there any obvious advantages of making the
tsvector part of the table and using a trigger to update it (or
refresh the vectors every night or something). Thanks!
Mike
On Thu, Aug 26, 2010 at
The simple answer is this:
SELECT
R.RecipeId, R.Title, R.Description, R.ImageUrl, R.Rating,
setweight(to_tsvector(title), 'A') ||
setweight(to_tsvector(coalesce(description, '')), 'B') ||
setweight(to_tsvector(coalesce(steps, '')), 'C') as vector,
ts_rank_cd(
setweight(to_tsvector(
I'm trying to make some improvements to my search results by taking
advantage of Postgres' setweight function, but am having a lot of
problems getting a query to run.. Here's the query that I run now
(I've removed some parts that just make it more complicated than you
need to be bothered with)..