{"id":22354273,"url":"https://github.com/jonmagic/docquery","last_synced_at":"2025-07-30T09:31:04.005Z","repository":{"id":32115519,"uuid":"35687951","full_name":"jonmagic/docquery","owner":"jonmagic","description":"Document query interface for plaintext documents stored in directories on a filesystem.","archived":false,"fork":false,"pushed_at":"2017-09-11T18:27:55.000Z","size":1992,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-10T12:08:53.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonmagic.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}},"created_at":"2015-05-15T17:44:55.000Z","updated_at":"2021-06-29T21:35:40.000Z","dependencies_parsed_at":"2022-08-26T13:31:05.925Z","dependency_job_id":null,"html_url":"https://github.com/jonmagic/docquery","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/jonmagic%2Fdocquery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmagic%2Fdocquery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmagic%2Fdocquery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmagic%2Fdocquery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonmagic","download_url":"https://codeload.github.com/jonmagic/docquery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228114865,"owners_count":17871742,"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":[],"created_at":"2024-12-04T13:12:09.757Z","updated_at":"2024-12-04T13:12:10.500Z","avatar_url":"https://github.com/jonmagic.png","language":"JavaScript","readme":"# DocQuery\n\nDocument query interface for plaintext documents stored in directories on a filesystem.\n\n## Installation\n\n```bash\n~ $ npm install docquery\n...\n```\n\n## Usage\n\n### Library\n\n```js\n\u003e var dq = new DocQuery(\"~/Projects/docquery/test/fixtures\", {recursive: true})\nDocQuery {}\n\n\u003e dq.search(\"star\")\n[{\"filePath\": \"/Users/jonmagic/Projects/docquery/test/fixtures/top-5/movies.md\",  \"fileName\": \"movies.md\",  \"title\": \"movies\",  \"modifiedAt\": \"2015-05-15T17:28:25.250Z\",  \"body\": \"...\"}]\n\n\u003e dq.documents\n// [...returns list of all documents sorted newest to oldest]\n\n\u003e dq.on(\"ready\", function() { console.log(\"fires when documents are finished loading\") })\n\u003e dq.on(\"added\", function(fileDetails) { console.log(\"fires when a document is added\") })\n\u003e dq.on(\"updated\", function(fileDetails) { console.log(\"fires when a document is updated\") })\n\u003e dq.on(\"removed\", function(fileDetails) { console.log(\"fires when a document is removed\") })\n```\n\n### Command Line\n\nHere's an example directory structure with some markdown documents in it.\n\n```bash\n~/Projects/docquery $ tree test/fixtures\ntest/fixtures\n├── 2015-05-15.md\n├── hello-world.md\n└── top-5\n    ├── burgers.md\n    └── movies.md\n\n1 directory, 4 files\n```\n\nUse the docquery command line tool `dq` to query those documents and get back json results.\n\n```bash\n~/Projects/docquery $ dq -r -p test/fixtures star\n[\n  {\n    \"filePath\": \"/Users/jonmagic/Projects/docquery/test/fixtures/top-5/movies.md\",\n    \"fileName\": \"movies.md\",\n    \"title\": \"movies\",\n    \"modifiedAt\": \"2015-05-15T17:28:25.250Z\",\n    \"body\": \"...\"\n  }\n]\n```\n\n`dq` takes a number of options.\n\n```bash\n~/Projects/docquery $ dq -h\nUsage: dq [options] query\n\nOptions:\n  -p, --path \u003cpath\u003e    Path to search\n  -r, --recursive      Search sub directories\n  -b, --body           Include document body in search result\n  -h, --help           Show dq help\n```\n\nReturn file paths only from the search results with [`jq`](http://stedolan.github.io/jq/).\n\n```bash\n~/Projects/docquery $ dq -rp test/fixtures star | jq .[].filePath\n\"/Users/jonmagic/Projects/docquery/test/fixtures/top-5/movies.md\"\n```\n\nSet default options by creating a `~/.dq` file that looks like this:\n\n```json\n{\n  \"recursive\": false,\n  \"searchPath\": \"~/Notes\",\n  \"includeBody\": false\n}\n```\n\n## Development\n\n```bash\n~/Projects/docquery $ npm test\n\n\u003e docquery@1.0.0 test /Users/jonmagic/Projects/docquery\n\u003e babel src --out-dir lib; mocha --compilers js:mocha-traceur test/*_test.js\n\nsrc/cli.js -\u003e lib/cli.js\nsrc/docquery.js -\u003e lib/docquery.js\n\n\n  DocQuery\n    #search\n      ✓ returns search result for query (214ms)\n      ✓ returns new documents in search results (418ms)\n      ✓ does not return document in search results after it has been deleted (626ms)\n    #documents\n      ✓ returns all documents (209ms)\n      ✓ returns documents sorted newest first (210ms)\n      ✓ returns new documents as they are added (414ms)\n      ✓ does not return document after it has been deleted (625ms)\n      ✓ ignores files in subfolders when recursive is false (419ms)\n\n\n  8 passing (3s)\n```\n\n## Contributors\n\n* [@jonmagic](https://github.com/jonmagic)\n* [@seongjaelee](https://github.com/seongjaelee)\n* [@lexicalunit](https://github.com/lexicalunit)\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Jonathan Hoyt\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonmagic%2Fdocquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonmagic%2Fdocquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonmagic%2Fdocquery/lists"}