{"action":"created","issue":{"url":"https://api.github.com/repos/Kurounin/Pagination/issues/13","repository_url":"https://api.github.com/repos/Kurounin/Pagination","labels_url":"https://api.github.com/repos/Kurounin/Pagination/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/Kurounin/Pagination/issues/13/comments","events_url":"https://api.github.com/repos/Kurounin/Pagination/issues/13/events","html_url":"https://github.com/Kurounin/Pagination/issues/13","id":173308829,"number":13,"title":"Meteor.users + Search","user":{"login":"odesey","id":3899366,"avatar_url":"https://avatars.githubusercontent.com/u/3899366?v=3","gravatar_id":"","url":"https://api.github.com/users/odesey","html_url":"https://github.com/odesey","followers_url":"https://api.github.com/users/odesey/followers","following_url":"https://api.github.com/users/odesey/following{/other_user}","gists_url":"https://api.github.com/users/odesey/gists{/gist_id}","starred_url":"https://api.github.com/users/odesey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odesey/subscriptions","organizations_url":"https://api.github.com/users/odesey/orgs","repos_url":"https://api.github.com/users/odesey/repos","events_url":"https://api.github.com/users/odesey/events{/privacy}","received_events_url":"https://api.github.com/users/odesey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-25T20:59:29Z","updated_at":"2016-08-29T09:00:35Z","closed_at":null,"body":"How would I go about implementing a  search feature combined with your package for Meteor.users()? I am already using the `filters` field to narrow the list of users to paginate based on other aspects of the app like so:\r\n`filters: { '_id': { '$in': org.membership.current } }`\r\n\r\nThis works perfectly. \r\n\r\nNow if I wanted to search the users, do I need to modify the `filters:' field to pass the search text? If so how would that query look.\r\n\r\nAlso on the server side, do I need to setup indexes to handle the fields that should be searched of will the pagination package handle that as well?\r\n\r\nThanks.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Kurounin/Pagination/issues/comments/243070641","html_url":"https://github.com/Kurounin/Pagination/issues/13#issuecomment-243070641","issue_url":"https://api.github.com/repos/Kurounin/Pagination/issues/13","id":243070641,"user":{"login":"Kurounin","id":2346482,"avatar_url":"https://avatars.githubusercontent.com/u/2346482?v=3","gravatar_id":"","url":"https://api.github.com/users/Kurounin","html_url":"https://github.com/Kurounin","followers_url":"https://api.github.com/users/Kurounin/followers","following_url":"https://api.github.com/users/Kurounin/following{/other_user}","gists_url":"https://api.github.com/users/Kurounin/gists{/gist_id}","starred_url":"https://api.github.com/users/Kurounin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kurounin/subscriptions","organizations_url":"https://api.github.com/users/Kurounin/orgs","repos_url":"https://api.github.com/users/Kurounin/repos","events_url":"https://api.github.com/users/Kurounin/events{/privacy}","received_events_url":"https://api.github.com/users/Kurounin/received_events","type":"User","site_admin":false},"created_at":"2016-08-29T09:00:35Z","updated_at":"2016-08-29T09:00:35Z","body":"You should be able to use only the $or operator, so it would be like:\r\n```js\r\nTemplate.myList.events({\r\n    'submit #searchForm': function (e, templateInstance) {\r\n        e.preventDefault();\r\n\r\n        const searchedValue = $.trim(templateInstance.$('#searchInput').val()).replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\r\n        const currentFilters = templateInstance.pagination.filters();\r\n\r\n        if (searchedValue.length > 0) {\r\n            currentFilters.$or = [\r\n                {'profile.lastName': { $regex: searchedValue, $options: 'i' } },\r\n                {'profile.firstName': { $regex: searchedValue, $options: 'i' } },\r\n                //additional fields to search go here\r\n            ];\r\n        } else {\r\n            delete currentFilters.$or;\r\n        }\r\n\r\n        templateInstance.pagination.filters(currentFilters);\r\n    }\r\n});\r\n```"}}
{"actor":{"display_login":"Kurounin"}}