{"id":31853514,"url":"https://github.com/programie/searchqueryparser-js","last_synced_at":"2026-01-20T16:32:17.776Z","repository":{"id":296559988,"uuid":"993732887","full_name":"Programie/SearchQueryParser-js","owner":"Programie","description":"A simple parser for search query strings written in TypeScript","archived":false,"fork":false,"pushed_at":"2025-09-10T03:15:58.000Z","size":66,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-25T09:36:09.716Z","etag":null,"topics":["query-parser","search"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Programie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2025-05-31T12:02:29.000Z","updated_at":"2025-05-31T17:32:04.000Z","dependencies_parsed_at":"2025-06-01T03:19:17.147Z","dependency_job_id":"c822ce3d-345d-435a-b95f-ae4940e5e610","html_url":"https://github.com/Programie/SearchQueryParser-js","commit_stats":null,"previous_names":["programie/searchqueryparser-js"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Programie/SearchQueryParser-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Programie%2FSearchQueryParser-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Programie%2FSearchQueryParser-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Programie%2FSearchQueryParser-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Programie%2FSearchQueryParser-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Programie","download_url":"https://codeload.github.com/Programie/SearchQueryParser-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Programie%2FSearchQueryParser-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011446,"owners_count":26084947,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["query-parser","search"],"created_at":"2025-10-12T13:29:31.420Z","updated_at":"2025-10-12T13:29:32.553Z","avatar_url":"https://github.com/Programie.png","language":"TypeScript","readme":"# Search Query Parser\n\nA simple parser for search query strings.\n\n## Usage\n\nThe main class of this library is `SearchQueryParser`. Initialize it with the query string to parse (see details bellow) and use it to check whether the supplied query matches something.\n\nThe method `matchesEntry` of the `SearchQueryParser` instance can be used to check whether the query matches a given entry. An entry is a plain JavaScript object where each property is the field to match and each property value the value to match.\n\n## Query syntax\n\nThe search query syntax is very basic but should be enough in most cases.\n\nEvery phrase is separated by spaces which means \"AND\". Connecting phrases using \"OR\" instead of \"AND\" is also possible by separating the phrases using `~`.\n\nExample of \"AND\" connected phrases:\n```\nsomething anotherthing\n```\n\nExample of \"OR\" connected phrases:\n```\nsomething~anotherthing\n```\n\nAdd quotes around a string if it contains spaces:\n```\nsomething \"another thing\"\n```\n\nTo combine \"AND\" as well as \"OR\" in a query, use round brackets:\n```\nsomething anotherthing (me~you)\n```\n\nBrackets can also be nested:\n```\n(something (anotherthing~anything)) (me~you)\n```\n\nTo exclude specific phrases, add `-` in front of the phrase:\n```\nfrom:me -to:someone\n\nto:someone -hello\n\nfrom:someone -excludethis -\"exclude that\"\n```\n\n## Examples\n\n### Basic queries\n\n```javascript\nlet parser = new SearchQueryParser('somefield:\"some value\" hello world');\n\n// This will match as \"somefield\" contains \"some value\", any field (\"anotherfield\" in this case) contains \"hello\" and any field (\"someotherfield\" in this case) contains \"world\"\nparser.matchesEntry({\n    somefield: \"This is some value\",\n    anotherfield: \"Hello\",\n    someotherfield: \"World\"\n});\n\n// This won't match as the phrase \"world\" is missing\nparser.matchesEntry({\n    somefield: \"This is some value\",\n    anotherfield: \"Hello\"\n});\n\n// This will match again as \"world\" is contained again\nparser.matchesEntry({\n    somefield: \"This is some value\",\n    anotherfield: \"Hello World\"\n});\n\n// This will also match even if the order of the searched phrases is different from the actual field content\nparser.matchesEntry({\n    somefield: \"This is some value\",\n    anotherfield: \"World said: Hello\"\n});\n```\n\n### Advanced queries\n\n```javascript\nlet parser = new SearchQueryParser('(from=me~from=you) (greeting=hello~greeting=hi) \"some text\"');\n\n// This will match as field \"from\" exactly matches \"me\", field \"greeting\" exactly matches \"hello\" and field \"text\" contains \"some text\"\nparser.matchesEntry({\n    from: \"me\",\n    greeting: \"Hello\",\n    text: \"This is some text to search.\"\n});\n\n// This will also match as field \"from\" exactly matches \"you\", field \"greeting\" exactly matches \"hello\" and field \"text\" contains \"some text\"\nparser.matchesEntry({\n    from: \"me\",\n    greeting: \"Hello\",\n    text: \"This is some text to search.\"\n});\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogramie%2Fsearchqueryparser-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprogramie%2Fsearchqueryparser-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogramie%2Fsearchqueryparser-js/lists"}