{"id":13392494,"url":"https://github.com/vuex-orm/plugin-search","last_synced_at":"2025-05-16T04:34:38.859Z","repository":{"id":28528549,"uuid":"118022104","full_name":"vuex-orm/plugin-search","owner":"vuex-orm","description":"Vuex ORM plugin for adding fuzzy search feature through model entities.","archived":false,"fork":false,"pushed_at":"2023-01-05T16:18:53.000Z","size":1708,"stargazers_count":42,"open_issues_count":18,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-01T06:18:34.928Z","etag":null,"topics":["vue","vuex","vuex-orm","vuex-orm-plugin","vuex-plugin"],"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/vuex-orm.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}},"created_at":"2018-01-18T18:33:34.000Z","updated_at":"2024-10-29T16:06:16.000Z","dependencies_parsed_at":"2022-07-22T17:32:43.612Z","dependency_job_id":null,"html_url":"https://github.com/vuex-orm/plugin-search","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vuex-orm%2Fplugin-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vuex-orm%2Fplugin-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vuex-orm%2Fplugin-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vuex-orm%2Fplugin-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vuex-orm","download_url":"https://codeload.github.com/vuex-orm/plugin-search/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254470308,"owners_count":22076566,"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":["vue","vuex","vuex-orm","vuex-orm-plugin","vuex-plugin"],"created_at":"2024-07-30T17:00:23.589Z","updated_at":"2025-05-16T04:34:33.850Z","avatar_url":"https://github.com/vuex-orm.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"192\" src=\"https://github.com/vuex-orm/vuex-orm/raw/master/logo-vuex-orm.png\" alt=\"Vuex ORM\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eVuex ORM Plugin: Search\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@vuex-orm/plugin-search\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@vuex-orm/plugin-search?color=blue\" alt=\"npm\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/vuex-orm/plugin-search\"\u003e\n    \u003cimg src=\"https://travis-ci.org/vuex-orm/plugin-search.svg?branch=master\" alt=\"Travis CI\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/vuex-orm/plugin-search\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/vuex-orm/plugin-search/branch/master/graph/badge.svg\" alt=\"codecov\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/vuex-orm/plugin-search/blob/master/LICENSE.md\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/l/@vuex-orm/plugin-search.svg\" alt=\"License\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nVuex ORM Search plugin adds a `search()` query chain modifier to easily filter matched records using fuzzy search logic from the [Fuse.js](http://fusejs.io/) library.\n\nA simple example to search for '_john_' within your query:\n\n```js\nconst users = User.query().search('john').get()\n```\n\n\u003ch2 align=\"center\"\u003eSponsors\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003eVuex ORM is sponsored by awesome folks. Big love to all of them from whole Vuex ORM community :two_hearts:\u003c/p\u003e\n\n\u003ch4 align=\"center\"\u003eSuper Love Sponsors\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/petertoth\"\u003e\n    \u003cimg src=\"https://avatars2.githubusercontent.com/u/3661783?s=460\u0026v=4\" alt=\"Peter Tóth\" width=\"88\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/phaust\"\u003e\n    \u003cimg src=\"https://avatars1.githubusercontent.com/u/2367770?s=460\u0026v=4\" alt=\"Mario Kolli\" width=\"88\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/cannikan\"\u003e\n    \u003cimg src=\"https://avatars2.githubusercontent.com/u/21893904?s=460\u0026v=4\" alt=\"Cannikan\" width=\"88\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/somazx\"\u003e\n    \u003cimg src=\"https://avatars0.githubusercontent.com/u/7306?s=460\u0026v=4\" alt=\"Andy Koch\" width=\"88\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/dylancopeland\"\u003e\n    \u003cimg src=\"https://avatars1.githubusercontent.com/u/99355?s=460\u0026v=4\" alt=\"Dylan Copeland\" width=\"88\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch4 align=\"center\"\u003eBig Love Sponsors\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/geraldbiggs\"\u003e\n    \u003cimg src=\"https://avatars1.githubusercontent.com/u/3213608?s=460\u0026v=4\" alt=\"geraldbiggs\" width=\"64\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/cuebit\"\u003e\n    \u003cimg src=\"https://avatars0.githubusercontent.com/u/1493221?s=460\u0026v=4\" alt=\"Cue\" width=\"64\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/kazupon\"\u003e\n    \u003cimg src=\"https://avatars0.githubusercontent.com/u/72989?s=400\u0026v=4\" alt=\"Kazuya Kawaguchi\" width=\"64\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/jShaf\"\u003e\n    \u003cimg src=\"https://avatars3.githubusercontent.com/u/30289?s=400\u0026v=4\" alt=\"jShaf\" width=\"64\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch4 align=\"center\"\u003eA Love Sponsors\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/georgechaduneli\"\u003e\n    \u003cimg src=\"https://avatars1.githubusercontent.com/u/9340753?s=460\u0026v=4\" alt=\"George Chaduneli\" width=\"48\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/bpuig\"\u003e\n    \u003cimg src=\"https://avatars3.githubusercontent.com/u/22938625?s=460\u0026v=4\" alt=\"bpuig\" width=\"48\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/robokozo\"\u003e\n    \u003cimg src=\"https://avatars2.githubusercontent.com/u/1719221?s=400\u0026v=4\" alt=\"John\" width=\"48\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/mean-cj\"\u003e\n    \u003cimg src=\"https://avatars3.githubusercontent.com/u/1191385?s=400\u0026v=4\" alt=\"mean-cj\" width=\"48\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\nInstall `@vuex-orm/plugin-search` alongside Vuex ORM.\n\n```bash\nnpm install @vuex-orm/core @vuex-orm/plugin-search --save\n# OR\nyarn add @vuex-orm/core @vuex-orm/plugin-search\n```\n\nThen install the plugin using Vuex ORM `use()` method.\n\n```js\nimport VuexORM from '@vuex-orm/core'\nimport VuexORMSearch from '@vuex-orm/plugin-search'\n\nVuexORM.use(VuexORMSearch, {\n  // Configure default fuse.js options here (see \"Configuration\" section below).\n})\n```\n\n### API\n\nThe search plugin method accepts two parameters.\n\n```ts\nsearch(terms: string | string[], options: Object): Query\n```\n\n- `terms` – any string or an array of strings.\n- `options` – see the [Configurations](#configurations) section below.\n\n\u003e **NOTE:** If passing an array of search terms, the results assume some element in the array to be matched.\n\n## Configurations\n\nThe plugin provides opinionated default Fuse.js options for token-based matching for optimum performance. These options can be easily changed at two stages of the plugin lifecycle:\n\n- Plugin installation (sets the global default options).\n- Runtime within the **search()** query chain.\n\nSee: [Fuse.js](http://fusejs.io/) for demo.\n\n| Property | Description | Default |\n| --- | --- | --- |\n| searchPrimaryKey | Also search the primary key | `false` |\n| location | Approximately where in the text is the pattern expected to be found | `0` |\n| distance | Determines how close the match must be to the fuzzy location | `100` |\n| threshold | **0.0** requires a perfect match, and a threshold of **1.0** would match anything | `0.3` |\n| maxPatternLength | Machine word size | `32` |\n| caseSensitive | Indicates whether comparisons should be case sensitive | `false` |\n| tokenSeparator | Regex used to separate words when searching. Only applicable when **tokenize** is **true** | `/ +/g` |\n| findAllMatches | When true, the algorithm continues searching to even if a perfect match is found | `false` |\n| minMatchCharLength | Minimum number of characters that must be matched before a result is considered a match | `1` |\n| keys | An array of fields (columns) to be included in the search | Keys from `Model.fields()` |\n| shouldSort | Whether to sort the result list, by score | `false` |\n| tokenize | When true, the search algorithm will search individual words **and** the full string, computing the final score as a function of both. **NOTE**: that when _tokenize_ is _true_, the **threshold**, **distance**, and **location** are inconsequential for individual tokens | `false` |\n| matchAllTokens | When true, the result set will only include records that match all tokens. Will only work if **tokenize** is also true. **NOTE**: It is better to use multiple **.search()** query chains if you have multiple terms that need to match. | `false` |\n| verbose | Will print to the console. Useful for debugging. | `false` |\n\n## Option Examples\n\nHere are some examples on how to use the search plugin with case specific options.\n\n### During Plugin Install\n\nFor example, if we want to match based on case sensitive and no fuzzy search logic (perfect match).\n\n```js\nVuexORM.use(VuexORMSearch, {\n  caseSensitive: true,\n  threshold: 0\n})\n```\n\n### During Query Chain\n\nThe global install options will now default to case sensitive and no fuzzy logic, but for example we have a run-time case we need to ignore case and implement a slightly more strict fuzzy search threshold.\n\nLet's also specify the need to only search the `firstName` and `lastName` fields.\n\n```js\nconst users = User.query().search('john', {\n  caseSensitive: false,\n  threshold: 0.3,\n  keys: ['firstName', 'lastName']\n}).get()\n```\n\n### Finding Results Matching Multiple Terms\n\nLet's find all matches where both `pat` and `male` exist in our records, and sort by the date added.\n\n```javascript\nconst data = User.query().search(['pat', 'male'], {\n  keys: ['firstName', 'gender']\n}).get()\n```\n\n## Questions \u0026 Discussions\n\nJoin us on our [Slack Channel](https://join.slack.com/t/vuex-orm/shared_invite/enQtNDQ0NjE3NTgyOTY2LTc1YTI2N2FjMGRlNGNmMzBkMGZlMmYxOTgzYzkzZDM2OTQ3OGExZDRkN2FmMGQ1MGJlOWM1NjU0MmRiN2VhYzQ) for any questions and discussions.\n\nAlthough there is the Slack Channel, do not hesitate to open an [issue](https://github.com/vuex-orm/plugin-search/issues) for any question you might have. We're always more than happy to hear any feedback, and we don't care what kind of form they are.\n\n## Plugins\n\nVuex ORM can be extended via plugins to add additional features. Here is a list of available plugins.\n\n- [Vuex ORM Axios](https://github.com/vuex-orm/plugin-axios) – The plugin to sync the store against a RESTful API.\n- [Vuex ORM GraphQL](https://github.com/vuex-orm/plugin-graphql) – The plugin to sync the store against a [GraphQL](https://graphql.org) API.\n- [Vuex ORM Change Flags](https://github.com/vuex-orm/plugin-change-flags) - Vuex ORM plugin for adding IsDirty / IsNew flags to model entities.\n- [Vuex ORM Soft Delete](https://github.com/vuex-orm/plugin-soft-delete) – Vuex ORM plugin for adding soft delete feature to model entities.\n\n## Contribution\n\nWe are excited that you are interested in contributing to Vuex ORM Plugin: Search! Anything from raising an issue, submitting an idea of a new feature, or making a pull request is welcome! Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.\n\n### Pull Request Guidelines\n\nWhen submitting a new pull request, please make sure to follow these guidelines:\n\n- **For feature requests:** Checkout a topic branch from `dev` branch, and merge back against `dev` branch.\n- **For bug fixes:** Checkout a topic branch from `master` branch, and merge back against `master` branch.\n\nThese rules also apply to the documentation. If you're submitting documentation about a new feature that isn't released yet, you must checkout the `dev` branch, but for non-functional updates, such as fixing a typo, you may checkout and commit to the `master` branch.\n\n### Scripts\n\nThere are several scripts to help with development.\n\n```bash\nyarn build\n```\n\nCompile files and generate bundles in `dist` directory.\n\n```bash\nyarn lint\n```\n\nLint files using [Prettier](https://prettier.io/).\n\n```bash\nyarn test\n```\n\nRun the test using [Jest](https://jestjs.io/).\n\n```bash\nyarn test:watch\n```\n\nRun the test in watch mode.\n\n```bash\nyarn coverage\n```\n\nGenerate test coverage in `coverage` directory.\n\n## License\n\nVuex ORM Plugin: Search is open-sourced software licensed under the [MIT license](./LICENSE).\n","funding_links":[],"categories":["Plugins"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvuex-orm%2Fplugin-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvuex-orm%2Fplugin-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvuex-orm%2Fplugin-search/lists"}