{"action":"created","issue":{"url":"https://api.github.com/repos/codeforamerica/ohana-api/issues/365","labels_url":"https://api.github.com/repos/codeforamerica/ohana-api/issues/365/labels{/name}","comments_url":"https://api.github.com/repos/codeforamerica/ohana-api/issues/365/comments","events_url":"https://api.github.com/repos/codeforamerica/ohana-api/issues/365/events","html_url":"https://github.com/codeforamerica/ohana-api/issues/365","id":104834200,"number":365,"title":"All service areas from all services at location inherited when using 'keyword' search.","user":{"login":"cderenburger","id":13293901,"avatar_url":"https://avatars.githubusercontent.com/u/13293901?v=3","gravatar_id":"","url":"https://api.github.com/users/cderenburger","html_url":"https://github.com/cderenburger","followers_url":"https://api.github.com/users/cderenburger/followers","following_url":"https://api.github.com/users/cderenburger/following{/other_user}","gists_url":"https://api.github.com/users/cderenburger/gists{/gist_id}","starred_url":"https://api.github.com/users/cderenburger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cderenburger/subscriptions","organizations_url":"https://api.github.com/users/cderenburger/orgs","repos_url":"https://api.github.com/users/cderenburger/repos","events_url":"https://api.github.com/users/cderenburger/events{/privacy}","received_events_url":"https://api.github.com/users/cderenburger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-09-04T05:47:20Z","updated_at":"2015-09-10T03:08:19Z","closed_at":null,"body":"When performing a <code>keyword=</code> search and setting a <code>service_area=</code> parameter, the results page includes all service areas for all services at a location, rather than the service area for the matching service.  This behavior is not present when setting a <code>category=</code> parameter.\r\n\r\nThis issue is perhaps better presented with some examples.\r\n\r\nWhen performing a search for \"Food Pantries\" the following results are given.\r\nhttps://win211-web-search.herokuapp.com/locations?utf8=%E2%9C%93&keyword=Food+Pantries&service_area=Wahkiakum&location=&org_name=\r\n\r\n![keyword_search](https://cloud.githubusercontent.com/assets/13293901/9677038/a001c51c-5289-11e5-80b4-947759005fe2.jpg)\r\n\r\nIf doing the same search but changing <code>keyword=</code> for <code>category[]=</code> the results are a correct match between the <code>category[]=</code> and <code>service_area=</code>\r\n\r\nhttps://win211-web-search.herokuapp.com/locations?utf8=%E2%9C%93&category[]=Food+Pantries&service_area=Wahkiakum&location=&org_name=\r\n\r\n![category_search](https://cloud.githubusercontent.com/assets/13293901/9677109/98d34666-528a-11e5-9c74-9210274b53d3.jpg)\r\n\r\n\r\n\"Puget Sound Labor Agency\", \"Lifelong\", and \"Northwest Harvest\" all include at least one service that includes the taxonomy term \"Food Pantries\", but that service does not contain the service area currently selected in the example.  These locations include other services which contain the service area, but not the taxonomy term.\r\n\r\nhttps://win211-web-search.herokuapp.com/locations/puget-sound-labor-agency?keyword=Food+Pantries&location=&org_name=&service_area=Wahkiakum&utf8=%E2%9C%93\r\n\r\n![details](https://cloud.githubusercontent.com/assets/13293901/9677162/4f3c1f04-528b-11e5-973a-d2474c038f26.jpg)\r\n\r\nThe Puget Sound Labor Agency is highlighted here as the simpler service for an example with one program the \"Food Pantry\" containing the taxonomy term \"Food Pantries\" in the service area \"King\" County.  This service is listed in the search results for \"Food Pantries\" all counties/service_areas in the state because the other program \"Wheelchair Ramps\" contains all 39 counties in the service area.\r\n\r\nIs there any way to have the <code>keyword=</code> searches return the correct services areas like <code>category=</code> searches?\r\n"},"comment":{"url":"https://api.github.com/repos/codeforamerica/ohana-api/issues/comments/139103170","html_url":"https://github.com/codeforamerica/ohana-api/issues/365#issuecomment-139103170","issue_url":"https://api.github.com/repos/codeforamerica/ohana-api/issues/365","id":139103170,"user":{"login":"cderenburger","id":13293901,"avatar_url":"https://avatars.githubusercontent.com/u/13293901?v=3","gravatar_id":"","url":"https://api.github.com/users/cderenburger","html_url":"https://github.com/cderenburger","followers_url":"https://api.github.com/users/cderenburger/followers","following_url":"https://api.github.com/users/cderenburger/following{/other_user}","gists_url":"https://api.github.com/users/cderenburger/gists{/gist_id}","starred_url":"https://api.github.com/users/cderenburger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cderenburger/subscriptions","organizations_url":"https://api.github.com/users/cderenburger/orgs","repos_url":"https://api.github.com/users/cderenburger/repos","events_url":"https://api.github.com/users/cderenburger/events{/privacy}","received_events_url":"https://api.github.com/users/cderenburger/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T03:08:19Z","updated_at":"2015-09-10T03:08:19Z","body":">Changing the current keyword search to only look in the Services table will not solve the problem because the tsvector column is on the Locations table.\r\n\r\nI presumed that a tsvector table would have to be created for the services table for a service based search to work.\r\n\r\nAt a basic level doesn't the api model the information as 'Locations have many Services'?  Wouldn't switching that model around to 'Services have many Locations' accomplish this?  I would think this would require a significant re-write and a different endpoint.  Not that I'm asking to have this done, just thinking it through.  I haven't looked through the code that helps determine what location/services are nearby or in the search area, or if in fact that the api is modeled this way by Locations to allow for location based searching."}}