{"id":20494870,"url":"https://github.com/apiko-dev/meteor-anti-search-source","last_synced_at":"2025-08-20T00:07:59.361Z","repository":{"id":88209928,"uuid":"48033119","full_name":"apiko-dev/meteor-anti-search-source","owner":"apiko-dev","description":"Flexible search in collections based on publish/subscribe","archived":false,"fork":false,"pushed_at":"2017-11-13T08:35:30.000Z","size":48,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-27T08:45:08.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/apiko-dev.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":"2015-12-15T09:32:38.000Z","updated_at":"2019-07-10T21:20:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"9305294f-f621-418a-8049-271f54a5679e","html_url":"https://github.com/apiko-dev/meteor-anti-search-source","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiko-dev%2Fmeteor-anti-search-source","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiko-dev%2Fmeteor-anti-search-source/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiko-dev%2Fmeteor-anti-search-source/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiko-dev%2Fmeteor-anti-search-source/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apiko-dev","download_url":"https://codeload.github.com/apiko-dev/meteor-anti-search-source/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248756283,"owners_count":21156744,"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":[],"created_at":"2024-11-15T17:43:37.538Z","updated_at":"2025-04-13T17:43:16.131Z","avatar_url":"https://github.com/apiko-dev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## jss:anti-search-source\n\nFlexible search in collections based on publish/subscribe\n\n### Features\n\n* Search by multiple fields\n* Searched fields transform\n* Search in local or global mode\n* High security level in global mode\n* Search in relatives collections\n\n\n### Search configuration\n\n* `collection` - instance of collection to search in;\n* `searchMode` - where search: `\"global\"` (server) or `\"local\"` (client);\n* `fields` - fields to search by. Also, support search in related collections;\n* `mongoQuery` - additional Mongo query;\n* `limit` - count of documents in result.\n\n### Client methods\n\n* `search('stringToSearch')` - changes search string;\n* `searchResult([options])` - return search result as Mongo.Cursor (Array for 'global' search). `options` work similarly to Meteor collection `find()`'s. Reactive data source;\n* `setMongoQuery(newMongoQuery)` - replaces Mongo query from configuration\n* `setLimit(newLimit)` - change limit;\n* `incrementLimit([increment=10])` - increase limit on `value`;\n* `isDataReady` - reactive state which shows if data is returned.\n\n### Usage example\n\n```js\nPersons = new Mongo.Collection('persons');\n\nif (Meteor.isClient) {\n  Template.hello.onCreated(function () {\n    this.searchSource = this.AntiSearchSource({\n      collection: Persons,\n      searchMode: 'global',\n      fields: ['name', 'email', {\n          collection: 'groups',\n          referenceField: 'groupId',\n          fields: ['groupDescription']\n      }, {\n          collection: 'home',\n          referenceField: 'homeId',\n          fields: ['homeDescription','otherField']\n      }],\n      mongoQuery: {\n        age: {$gte: 30}\n      },\n      limit: 10\n    });\n  });\n\n  Template.hello.helpers({\n    searchResult: function () {\n      return Template.instance().searchSource.searchResult();\n    }\n  });\n\n  Template.hello.events({\n    'keyup input': _.throttle(function (event, tmpl) {\n      tmpl.searchSource.search($('input').val())\n    }, 1500)\n  });\n}\n\nif (Meteor.isServer) {\n  AntiSearchSource.allow('persons', {\n    maxLimit: 20,\n    securityCheck (userId, configs) {\n      return !!userId;\n    },\n    allowedFields: ['name', 'email']\n  });\n}\n```\n\n### Todos\n- [ ] Remove Blaze dependency\n\n### Changelog\n\n* 1.4.3 - Fix server side sort issue.\n* 1.3.0 - Translated to ES6, fully refactored, added search by related documents.\n\n\nMade by [![Professional Meteor Development Studio](http://s30.postimg.org/jfno1g71p/jss_xs.png)](http://jssolutionsdev.com) - [Professional Meteor Development Company](http://jssolutionsdev.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiko-dev%2Fmeteor-anti-search-source","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapiko-dev%2Fmeteor-anti-search-source","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiko-dev%2Fmeteor-anti-search-source/lists"}