{"id":18918865,"url":"https://github.com/justintanner/collector-search","last_synced_at":"2026-01-27T19:50:52.756Z","repository":{"id":57203185,"uuid":"341340027","full_name":"justintanner/collector-search","owner":"justintanner","description":"A library for searching ordered JSON data.","archived":false,"fork":false,"pushed_at":"2024-10-09T02:11:53.000Z","size":7532,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-16T23:12:55.918Z","etag":null,"topics":["json","search"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justintanner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-02-22T21:18:06.000Z","updated_at":"2022-01-26T01:52:34.000Z","dependencies_parsed_at":"2024-11-08T10:37:33.671Z","dependency_job_id":"d1ab5a8b-57d7-4d3d-a054-7b9d818bd13e","html_url":"https://github.com/justintanner/collector-search","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/justintanner/collector-search","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justintanner%2Fcollector-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justintanner%2Fcollector-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justintanner%2Fcollector-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justintanner%2Fcollector-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justintanner","download_url":"https://codeload.github.com/justintanner/collector-search/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justintanner%2Fcollector-search/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28819909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["json","search"],"created_at":"2024-11-08T10:34:04.407Z","updated_at":"2026-01-27T19:50:52.735Z","avatar_url":"https://github.com/justintanner.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Collector Search\n\nA library for searching ordered JSON data.\n\n### Features\n\n* Returns results in the same order as the input (by an order field)\n* Only dependency is lodash\n* No need to index the data\n\n### Installation\n\n`npm install collector-search`\n\n### Example Usage\n\n```js\nconst books = [\n  {\n    id: 1,\n    title: 'War and Peace',\n    content: 'A story about the Russian Revolution',\n    position: 2\n  },\n  {\n    id: 2,\n    title: 'A Tale of Two Cities',\n    content: 'A story about the French Revolution',\n    position: 1\n  }\n];\n\nconst cs = CollectorSearch({\n  documents: books,\n  keysToExclude: ['id', 'order'],\n  orderBy: 'position'\n});\n\n// returns A Tale of Two Cities, then War and Peace\nconst results = cs.search('story');\n```\n\n### Advanced Search for numeric values\n\n```js\nconst postcards = [\n  {\n    id: 1,\n    title: 'Two hundred series postcard #1',\n    number: 201,\n    position: 1\n  },\n  {\n    id: 2,\n    title: 'Two hundred series postcard #2',\n    number: 202,\n    position: 2\n  },\n  {\n    id: 3,\n    title: 'Three hundred series postcard #1',\n    number: 201,\n    position: 3\n  }\n];\n\nconst cs = CollectorSearch({\n  documents: postcards,\n  keysToExclude: ['id'],\n  orderBy: 'position'\n});\n\n// returns the first two cards\nconst results = cs.search('number: 200-201');\n```\n\n### Pre-generating indexes\n\nIf your json data is not changing you can pre-generate an index by doing the following.\n\n```js\nconst cs = CollectorSearch({ documents: documents });\nconst injectedDocuments = cs.injectIndex();\n```\n\nThen you save your injected documents into a file with a script like the following.\n\n```js\nimport fs from 'fs';\n\nfs.writeFileSync('documents.json', JSON.stringify(injectedDocuments));\n```\n\n### Version History\n\n* 1.0.0\n    * Initial Release\n* 1.0.1\n    * Removed option `fields` and search all fields other thans `keysToExclude`\n    * Fixed bug where half generated indexes caused the search to fail\n\n### License\n\nThis project is licensed under the MIT License - see the MIT_LICENSE file for details\n\n### Acknowledgments\n\nInspiration\n\n* [ss-search](https://github.com/yann510/ss-search)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustintanner%2Fcollector-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustintanner%2Fcollector-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustintanner%2Fcollector-search/lists"}