{"id":14972157,"url":"https://github.com/skipperbent/pecee-boolean-query-parser","last_synced_at":"2025-10-26T18:31:35.166Z","repository":{"id":57037373,"uuid":"124991366","full_name":"skipperbent/pecee-boolean-query-parser","owner":"skipperbent","description":"Convert a boolean search query into a query that is compatible with a fulltext search.","archived":false,"fork":false,"pushed_at":"2019-05-31T09:34:55.000Z","size":21,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"v1-release","last_synced_at":"2025-01-31T22:11:42.838Z","etag":null,"topics":["boolean-query","boolean-query-formatter","boolean-query-parser","database","fulltext-query","mysql-fulltext-query","mysql-query-parser"],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/skipperbent.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":"2018-03-13T04:17:33.000Z","updated_at":"2023-09-15T14:17:45.000Z","dependencies_parsed_at":"2022-08-24T05:11:16.997Z","dependency_job_id":null,"html_url":"https://github.com/skipperbent/pecee-boolean-query-parser","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skipperbent%2Fpecee-boolean-query-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skipperbent%2Fpecee-boolean-query-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skipperbent%2Fpecee-boolean-query-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skipperbent%2Fpecee-boolean-query-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skipperbent","download_url":"https://codeload.github.com/skipperbent/pecee-boolean-query-parser/tar.gz/refs/heads/v1-release","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238386068,"owners_count":19463290,"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":["boolean-query","boolean-query-formatter","boolean-query-parser","database","fulltext-query","mysql-fulltext-query","mysql-query-parser"],"created_at":"2024-09-24T13:46:28.546Z","updated_at":"2025-10-26T18:31:34.816Z","avatar_url":"https://github.com/skipperbent.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pecee/boolean-query-parser\n\nConvert a boolean search query into a query that is compatible with a fulltext search.\n\n### Notes\n\nThis library is a maintained fork of the original project \"BooleanSearchParser\" created by DuncanOglethat, [available here](https://github.com/DuncanOgle/BooleanSearchParser).\n\nThe goal of this project is to iron out bugs, optimise the code, add new features and make it compatible with future versions of PHP.\n\n## Requirements\n\n- PHP 7.1 or higher\n\n### Installation\n\n```\ncomposer require pecee/boolean-query-parser\n```\n\n### Parsing a query\n\n```php\n$parser = new \\Pecee\\BooleanQueryParser\\BooleanQueryParser();\n\n$formattedQuery = $parser-\u003eparse('ict OR (technology AND bob)');\n```\n\n**Output**\n\n```\nict (+technology +bob)\n```\n\n### Order\n\nOrder and brackets are important, more often than not OR logic takes priority\n\n`sales OR finance AND manager` will become `sales finance +manager` and not `sales +finance +manager`\n\n## Examples\n\n|Input|Output|\n|-----|------|\n|`ict` |   `+ict`|\n|`ict it` |   `+ict +it`|\n|`ict OR it` |   `ict it`|\n|`NOT ict` |   `-ict`|\n|`it NOT ict` |   `+it -ict`|\n|`web AND (ict OR it)` |   `+web +(ict it)`|\n|`ict OR (it AND web)` |   `ict (+it +web)`|\n|`ict NOT (ict AND it AND web)` |   `+ict -(+ict +it +web)`|\n|`php OR (NOT web NOT embedded ict OR it)` |   `php (-web -embedded ict it)`|\n|`(web OR embedded) (ict OR it)` |   `+(web embedded) +(ict it)`|\n|`develop AND (web OR (ict AND php))` |   `+develop +(web (+ict +php))`|\n|`\"ict` |   `null `|\n|`\"ict OR it\"` |   `+\"ict OR it\"`|\n\n## Advanced examples\n|Input|Output|\n|-----|------|\n`\"business development\" or \"it sales\" and (danish or dutch or italian or denmark or holland or netherlands or italy)` | `\"business development\" \"it sales\" +(danish dutch italian denmark holland netherlands italy)`\n`(procurement or buying or purchasing) and (marine or sea) and (engineering or engineer)` | `+(procurement buying purchasing) +(marine sea) +(engineering engineer)`\n\n## Licence\n\nLicensed under the MIT licence.\n\n### The MIT License (MIT)\n\nCopyright (c) 2018 Simon Sessingø / pecee-boolean-query-parser\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.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskipperbent%2Fpecee-boolean-query-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskipperbent%2Fpecee-boolean-query-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskipperbent%2Fpecee-boolean-query-parser/lists"}