Reputation: 48197
I can add 4 weights but the moment I add the fifth got an error
update pois
set tsearch = setweight(to_tsvector(name), 'A') ||
setweight(to_tsvector(coalesce(state_name, '')), 'B') ||
setweight(to_tsvector(coalesce(city_name)), 'C') ||
setweight(to_tsvector(coalesce(address, '')), 'D') || -- 4 weight work ok
setweight(to_tsvector(coalesce(sector_name, '')), 'E'); -- add this and got error
ERROR: unrecognized weight: 69
SQL state: XX000
Upvotes: 3
Views: 902
Reputation: 7892
documentation says you can only have 4:
setweight returns a copy of the input vector in which every position has been labeled with the given weight, either A, B, C, or D. (D is the default for new vectors and as such is not displayed on output.) These labels are retained when vectors are concatenated, allowing words from different parts of a document to be weighted differently by ranking functions.
Note that weight labels apply to positions, not lexemes. If the input vector has been stripped of positions then setweight does nothing.
Upvotes: 4