Search ranking doesn't work when a search column is NULL

When adding all ts_rank together and one of them is NULL (happens when the column's value is NULL), the sum adds up to NULL and the result can't be ranked. So if there is a really good match on many columns but one column happens to be NULL, it breaks the ranking system.

My suggestion is to put COALESCE(ts_rank(...),0) on each ts_rank statement to make sure the rank on the individual column evaluates to 0 if the column is NULL.