Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Concatinating TSVectors results in the index values starting from the highest of the left one + 1 for all atoms in the right one:
- to_tsvector('keyword', 'the quick brown fox jumps over the lazy dog') || setweight(to_tsvector('simple', 'the quick brown fox jumps over the lazy dog'), 'A')
- results in
- 'brown':3,12A 'dog':9,18A 'fox':4,13A 'jump':5 'jumps':14A 'lazi':8 'lazy':17A 'over':6,15A 'quick':2,11A 'the':1,7,10A,16A
- Building a new one as strings collapses them, so that each entry only shows up once per real position. However, the highest weight is the only one kept:
- (to_tsvector('keyword', 'the quick brown fox jumps over the lazy dog')::text || ' ' || setweight(to_tsvector('simple', 'the quick brown fox jumps over the lazy dog'), 'A')::text)::tsvector
- results in
- 'brown':3A 'dog':9A 'fox':4A 'jump':5 'jumps':5A 'lazi':8 'lazy':8A 'over':6A 'quick':2A 'the':1A,7A
- The latter will, in theory, take up less space due to the lack of duplicated position information.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement