{"id":17725668,"url":"https://github.com/fedemartinm/react-search-operators","last_synced_at":"2025-08-02T20:32:59.121Z","repository":{"id":44254919,"uuid":"258948258","full_name":"fedemartinm/react-search-operators","owner":"fedemartinm","description":"Search component based on search-operators","archived":false,"fork":false,"pushed_at":"2024-04-23T02:11:44.000Z","size":6294,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-29T02:15:38.510Z","etag":null,"topics":["commands","parser","react","search"],"latest_commit_sha":null,"homepage":"https://fedemartinm.github.io/react-search-operators/","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/fedemartinm.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":"2020-04-26T05:34:27.000Z","updated_at":"2024-06-20T11:13:44.000Z","dependencies_parsed_at":"2024-10-25T20:10:00.810Z","dependency_job_id":"e27c7ff9-417c-4633-9f5b-d113b628b784","html_url":"https://github.com/fedemartinm/react-search-operators","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fedemartinm/react-search-operators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedemartinm%2Freact-search-operators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedemartinm%2Freact-search-operators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedemartinm%2Freact-search-operators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedemartinm%2Freact-search-operators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fedemartinm","download_url":"https://codeload.github.com/fedemartinm/react-search-operators/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedemartinm%2Freact-search-operators/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268048969,"owners_count":24187234,"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-07-31T02:00:08.723Z","response_time":66,"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":["commands","parser","react","search"],"created_at":"2024-10-25T16:05:16.003Z","updated_at":"2025-08-02T20:32:59.080Z","avatar_url":"https://github.com/fedemartinm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![npm](https://img.shields.io/npm/v/react-search-operators)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-search-operators?color=green)\n\n# React Search Operators\nSearch component based on [search-operators](https://github.com/fedemartinm/search-operators), where users can type search queries and apply filters.\n\n- complete set of operators \n- sentence tokenization\n- complete theming freedom\n- highly customizable through composition\n\n\nUse this package when you want to parse a search query. If you don't need parse input but you need advanced features in suggestions maybe you are looking for [react-autosuggest](https://github.com/moroshko/react-autosuggest).\n\n### Installation\n```shell\nyarn add react-search-operators\n```\n\nor\n\n```shell\nnpm install react-search-operators --save\n```\n\n### Basic Usage\n```javascript\nimport React, { useState } from 'react'\nimport ReactDOM from 'react-dom'\nimport Search from 'react-search-operators'\nimport 'react-search-operators/dist/index.css';\n\nconst App = () =\u003e {\n  const [state, setState] = useState({})\n  console.log(state);\n  return (\n    \u003cdiv className='app'\u003e\n      \u003cSearch onChange={setState} onSearch={onSearch}/\u003e\n    \u003c/div\u003e\n  )\n}\n\n// write \"I need +results\" on input, then\n// open debug console:\n//{\n//  {\n//    \"filters\": [{ \"type\": \"exact\", \"value\": \"results\" }],\n//    \"terms\": [\"I\",\"need\"]\n//  }\n//  \"text\": \"I need +results\"\n//}\n\nReactDOM.render(\u003cApp/\u003e, document.getElementById('root'))\n\n```\nCheck out [github-page](https://fedemartinm.github.io/react-search-operators/) to see more examples!\n\n### Operators\n - exact word or phrase\n - exclude word\n - match\n - inverse match\n\nComplete documentation [here](https://github.com/fedemartinm/search-operators#operators).\n\n### Props\n| Prop   | Type    | Description | Notes |\n|--------|---------|-------------|-------|\n|  as    | elementType  | an element type to render as input | See an example [here](https://github.com/fedemartinm/react-search-operators/blob/master/example/src/Examples/Highlighting/DraftInput.js).  |\n|  text    | string  | search text  | Use it on controlled implementations.   |\n|  icon    | elementType  |  an element type to render as icon  |   |\n|  parser    | function  |  replace default parser implementation  |  |\n|  parserOptions    | object  |  default parser options  | See default [search-opeartors](https://github.com/fedemartinm/search-operators#api) options. |\n|  suggestions    | array  |  search suggestions  | See [suggestions example](https://github.com/fedemartinm/react-search-operators/blob/master/example/src/Examples/Suggestions/App.js). |\n|  suggestionAs    | elementType  |  an element type to render as suggestion  |   |\n|  id    | string    | IDs used in ARIA |  If component is used more than once to be sure each is unique.  |\n|  theme    | object, array    | style your search component  |  CSS Modules, Inline Styles, etc. See [react-themeable](https://github.com/markdalgleish/react-themeable) |\n|  placeholder    | string  | input placeholder text  |   |\n|  onSearch    | function  |  called after user clicks search or types enter   |   |\n|  onSelect    | function  |  called when a suggestion is clicked |   |\n|  onChange    | function  |  called every time search is parsed  |   |\n|  onTextChange    | function  |  called every time search text change  | Use it on controlled implementations.  |\n\n### API\n\n#### Events:\n- onSearch(searchQuery)\n```js\nsearchQuery: {\n  text, // search text\n  parsed, // ParseResult object\n  tokens, // Token array\n  suggestions //Suggestion array\n}\n```\n- onChange(searchParseResult)\n```js\nsearchParseResult: {\n  text, // search text\n  parsed // ParseResult object\n}\n```\n\n- onSelect(suggestion)\n```js\n// user defined suggestion object\n```\n\n- onTextChange(text)\n```js\n// text string\n```\n\n#### Types:\n\n- ParseResult (default implementation)\n```js\n{\n  filters: [\n    { \n      type, //one of 'match' | 'not-match' | 'exact' | 'exclude',\n      value, //value \n      in //optional, used by match and not-match operator\n    }\n  ],\n  terms: [] // search terms\n}\n```\n\n\n- Token (default implementation)\n```js\n{\n  type, // token type, one of: TEXT, INCLUDE_WORD, EXCLUDE_WORD, EXACT_PHRASE, MATCH, NOT_MATCH,\n  value, // matched string\n  // Token location data\n  startOffset, \n  endOffset, \n  startLine,\n  endLine,\n  startColumn,\n  endColumn,\n}\n```\n\n### Supported browsers\nMinimum **confirmed** browser requirements to run React-Search-Operators. Testing was done using the sample project.\n\n\n| Chrome | Firefox | Safari | Opera | Edge | IE |\n|--------|---------|--------|-------|------|----|\n| 38     |    31   |   9.1  |   25  |  16  | 11 |\n\n## Licence \n[MIT](https://github.com/fedemartinm/react-search-operators/blob/master/LICENSE) do whatever you want to do!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffedemartinm%2Freact-search-operators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffedemartinm%2Freact-search-operators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffedemartinm%2Freact-search-operators/lists"}