Last active
April 1, 2020 17:32
-
-
Save kreas/86c23c2c91cf917442ee8cf6d8549b76 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- View for search vectors | |
| CREATE OR REPLACE VIEW vw_listing_search AS | |
| SELECT | |
| stock_number, | |
| to_tsvector(coalesce(description, '')) || | |
| to_tsvector(coalesce(b.name, '')) || | |
| to_tsvector(coalesce(t.name, '')) || | |
| to_tsvector(coalesce(mm.name, '')) AS search_vector | |
| FROM listings | |
| LEFT JOIN brands b ON (listings.brand->>'id')::INT = b.machine_hub_id | |
| LEFT JOIN machine_types t ON (listings.type->>'id')::INT = t.machine_hub_id | |
| LEFT JOIN machine_models mm ON (listings.model->>'id')::INT = mm.machine_hub_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment