{"id":19701756,"url":"https://github.com/kuzzleio/koncorde","last_synced_at":"2025-04-09T12:08:53.908Z","repository":{"id":49420219,"uuid":"102497977","full_name":"kuzzleio/koncorde","owner":"kuzzleio","description":"Supersonic reverse-search engine, featuring a full-fledged DSL, including geofencing capabilities","archived":false,"fork":false,"pushed_at":"2025-01-15T14:27:04.000Z","size":1590,"stargazers_count":27,"open_issues_count":0,"forks_count":5,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-02T10:13:13.151Z","etag":null,"topics":["filter","geofencing","kuzzle","realtime","reverse-search"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kuzzleio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-09-05T15:23:45.000Z","updated_at":"2025-01-15T14:22:43.000Z","dependencies_parsed_at":"2023-01-31T10:00:33.539Z","dependency_job_id":"46fdf1ee-3f7c-4b74-aa1a-1babdf4dc0c8","html_url":"https://github.com/kuzzleio/koncorde","commit_stats":{"total_commits":123,"total_committers":16,"mean_commits":7.6875,"dds":0.6991869918699187,"last_synced_commit":"3441e236ab72d3550ce0a5e0683d1618d86e980d"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuzzleio%2Fkoncorde","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuzzleio%2Fkoncorde/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuzzleio%2Fkoncorde/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuzzleio%2Fkoncorde/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuzzleio","download_url":"https://codeload.github.com/kuzzleio/koncorde/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036067,"owners_count":21037092,"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":["filter","geofencing","kuzzle","realtime","reverse-search"],"created_at":"2024-11-11T21:10:15.444Z","updated_at":"2025-04-09T12:08:53.887Z","avatar_url":"https://github.com/kuzzleio.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![Codecov](http://codecov.io/github/kuzzleio/koncorde/coverage.svg?branch=master)](http://codecov.io/github/kuzzleio/koncorde?branch=master)\n[![Code Quality: Javascript](https://img.shields.io/lgtm/grade/javascript/g/kuzzleio/koncorde.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/kuzzleio/koncorde/context:javascript)\n[![Total Alerts](https://img.shields.io/lgtm/alerts/g/kuzzleio/koncorde.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/kuzzleio/koncorde/alerts)\n\n# Koncorde\n\nThis module is a reverse-search engine.\n\nInstead of indexing data and searching for them using filters, Koncorde does the opposite: it indexes search filters, and returns the corresponding ones when presented with data.\n\n* an arbitrary large number of filters can be registered and indexed;\n* whenever data are submitted to Koncorde, it returns the list of indexed filters matching them;\n* Koncorde's [filter syntax](https://github.com/kuzzleio/koncorde/wiki/Filter-Syntax) supports a variety of different matchers, and ways to combine them.\n\nKoncorde can be used in a variety of ways. For instance:\n\n* as a base of a notification system, where indexed filters are used as user subscriptions: Koncorde tells which JSON objects verify what subscriptions, making it easy to send events to listening users; \n* to verify if JSON objects comply to filters used as validation rules.\n\nCheck our [full documentation](https://github.com/kuzzleio/koncorde/wiki) to know more about Koncorde's API, filter syntax, and more.\n\n\n# Quick start example\n\nIn the following example, we'll listen to objects containing a `position` property, describing a geopoint. We want that geopoint to be 500 meters around a pre-defined starting position.\n\nThis can be described by the following Koncorde filter:\n\n```json\n{\n    \"geoDistance\": {\n        \"position\": {\n            \"lat\": 43.6073913,\n            \"lon\": 3.9109057\n        },\n        \"distance\": \"500m\"\n    }\n}\n```\n\nAll you need to do now is to register this filter to the engine, and use it to test data:\n\n```js\nimport { Koncorde } from 'koncorde';\n\nconst engine = new Koncorde();\n\nconst filter = {\n    geoDistance: {\n        position: {\n            lat: 43.6073913,\n            lon: 3.9109057\n        },\n        distance: \"500m\"\n    }\n};\n\nconst filterId = engine.register(filter);\n\n// Filter Identifiers are seeded. Given the same seed (to be provided to the\n// constructor), then the filter IDs stay stable.\nconsole.log(`Filter identifier: ${filterId}`);\n\n// No match found, returns an empty array (distance is greater than 500m)\nconsole.log(engine.test({ position: { lat: 43.6073913, lon: 5.7 } }));\n\n// Point within the filter's scope: returns the list of matched filters\n// Here we registered just one of them, so the array contains only 1 filter ID\nconsole.log(engine.test({ position: { lat: 43.608, lon: 3.905 } }));\n\n// No match found, returns an empty array \n// (the geopoint in the provided data is not stored in the tested field)\nconsole.log(engine.test({ not_position: { lat: 43.608, lon: 3.905 } }));\n```\n\n# Install\n\nThis library is compatible with Node.js version 12.x or higher.\nBoth a C and a C++ compilers are needed to install its dependencies: Koncorde cannot be used in a browser.\n\nKoncorde is compatible with either Javascript or Typescript projects.\n\nTo install:\n\n```\nnpm install koncorde\n```\n\n\n## Benchmarks\n\nThe following results are obtained running `node benchmark.js` at the root of the projet.\n\n```\nFilter count per tested keyword: 10000\n\n\u003e Benchmarking keyword: equals\n  Indexation: time = 0.255s, mem = +39MB\n  Matching x 10,320,209 ops/sec ±0.70% (95 runs sampled)\n  Filters removal: time = 0.018s\n\n\u003e Benchmarking keyword: exists\n  Indexation: time = 0.285s, mem = +20MB\n  Matching x 5,047,932 ops/sec ±0.23% (97 runs sampled)\n  Filters removal: time = 0.021s\n\n\u003e Benchmarking keyword: geoBoundingBox\n  Indexation: time = 0.685s, mem = +-8MB\n  Matching x 1,322,528 ops/sec ±0.52% (94 runs sampled)\n  Filters removal: time = 0.092s\n\n\u003e Benchmarking keyword: geoDistance\n  Indexation: time = 1.052s, mem = +3MB\n  Matching x 1,656,882 ops/sec ±0.65% (96 runs sampled)\n  Filters removal: time = 0.094s\n\n\u003e Benchmarking keyword: geoDistanceRange\n  Indexation: time = 1.551s, mem = +20MB\n  Matching x 1,344,257 ops/sec ±2.83% (90 runs sampled)\n  Filters removal: time = 0.101s\n\n\u003e Benchmarking keyword: geoPolygon (5 vertices)\n  Indexation: time = 0.818s, mem = +-74MB\n  Matching x 112,091 ops/sec ±0.54% (97 runs sampled)\n  Filters removal: time = 0.098s\n\n\u003e Benchmarking keyword: in (5 random values)\n  Indexation: time = 0.974s, mem = +90MB\n  Matching x 3,579,507 ops/sec ±2.93% (92 runs sampled)\n  Filters removal: time = 0.058s\n\n\u003e Benchmarking keyword: range (random bounds)\n  Indexation: time = 0.276s, mem = +-72MB\n  Matching x 122,311 ops/sec ±1.28% (96 runs sampled)\n  Filters removal: time = 0.074s\n```\n\n_(results obtained with node v16.2.0)_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuzzleio%2Fkoncorde","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuzzleio%2Fkoncorde","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuzzleio%2Fkoncorde/lists"}