{"id":20399511,"url":"https://github.com/mujz/pg-search-sequelize-example","last_synced_at":"2025-10-29T15:23:51.702Z","repository":{"id":124436625,"uuid":"84035300","full_name":"mujz/pg-search-sequelize-example","owner":"mujz","description":"An example use case of pg-search-sequelize node library","archived":false,"fork":false,"pushed_at":"2017-03-15T06:42:50.000Z","size":14,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T08:07:02.834Z","etag":null,"topics":["database","database-search","fast","full-text","full-text-search","materialized","materialized-view","materialized-views","node","nodejs","postgres","postgresql","search","search-algorithm","sequelize","sequelizejs","view"],"latest_commit_sha":null,"homepage":"https://github.com/mujz/pg-search-sequelize","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mujz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-06T05:52:53.000Z","updated_at":"2022-09-14T14:55:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"a70fe9e4-b204-4832-a785-3873e4ee9a92","html_url":"https://github.com/mujz/pg-search-sequelize-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mujz%2Fpg-search-sequelize-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mujz%2Fpg-search-sequelize-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mujz%2Fpg-search-sequelize-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mujz%2Fpg-search-sequelize-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mujz","download_url":"https://codeload.github.com/mujz/pg-search-sequelize-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248571999,"owners_count":21126560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","database-search","fast","full-text","full-text-search","materialized","materialized-view","materialized-views","node","nodejs","postgres","postgresql","search","search-algorithm","sequelize","sequelizejs","view"],"created_at":"2024-11-15T04:29:41.720Z","updated_at":"2025-10-29T15:23:46.662Z","avatar_url":"https://github.com/mujz.png","language":"JavaScript","readme":"# PG Search Sequelize - Example\n\nDemonstration of how to use the `pg-search-sequelize` package to search a database of films and actors.\n\n# Demo\n\nTry out this example's demo [here](https://mujz.ca/project/pg-search).\n\n# Run it locally\n\nPrerequisites: Docker. If you don't want to use Docker, you'll need to have Postgres and Node.js 6.0.0 or above installed.\n\nTo start the server and database with docker, run:\n\n```js\n./init.sh\n```\n\nThat's it. Now you can open your browser and navigate to `http://localhost:3000/`.\n\nTest searching by navigating to `http://localhost:3000/film/x-men`. To filter your results by release year, modify your query to `http://localhost:3000/film/x-men releaseYear:2003`. Note that we did not hard code the release year filter; it is automatically provided by the `pg-search-sequelize` package.\n\n# How It Works\n\nOur database is very simple; we only have 3 tables: `film`, `actor`, and `film_actor`. Using `pg-search-sequelize`, we create a materialized view from the film and actor data. We give the film names the highest weight, details and cast get a lower weight, and the rest of the details follow in order. The weighting system allows our search results to be sorted by relevance depending on how we set it up. Because we gave movie names a higher order than cast names, a search query of \"Washington\" would yield a result of the movie \"Washington Heights\" before \"Man on Fire,\" since the first has the search query in the movie name while the second has it in the movie's cast.\n\nWe then define our materialized view model in `/models` and register it with `pg-search-sequelize` so that we get the search functionality.\n\nFinally, we expose two API `/film/:query` and we start the express server on port `3000`.\n\n# Next Steps\n\nIf you are interested in using this package in your projects, head on over to [pg-search-sequelize](https://github.com/mujz/pg-search-sequelize).\n\nIf there's anything you didn't like, or if you have any comments or suggestions, please do submit them in the issues section of [pg-search-sequelize](https://github.com/mujz/pg-search-sequelize)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmujz%2Fpg-search-sequelize-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmujz%2Fpg-search-sequelize-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmujz%2Fpg-search-sequelize-example/lists"}