Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated listings when setting service_area #357

Closed
cderenburger opened this issue Aug 15, 2015 · 7 comments
Closed

Repeated listings when setting service_area #357

cderenburger opened this issue Aug 15, 2015 · 7 comments

Comments

@cderenburger
Copy link

I'm having an issue with repeated listings when including &service_area=County
I just merged from the master branch at https://github.com/codeforamerica/ohana-api to bring my local installation up to date. I'm pretty sure this was working correctly a few days ago before having synced with the repo. When running git diff upstream/master with my current branch the only differences are in my database.yml and settings.yml.

The url address below is http://elizabeth.duckdns.org:4000/locations?keyword=Food+Pantries&service_area=Clallam
tafy

I reset and re-imported my data to see if that was the issue, same problem. When viewing the service record in localhost:8080/admin the service_area is only listed once in the service record.

The record "The Answer for Youth" has 5 services, and is seen repeating 5 times. The same happens with other agencies. I checked my taxonomy for each service record and each does have different taxonomy codes selected.

If I do not use &service_area=County and instead use &location=port angeles I get the expected result of one listing for the service.

Anyone else having this issue?

@cderenburger cderenburger changed the title Multiple listings when setting service_area Repeated listings when setting service_area Aug 15, 2015
@cderenburger
Copy link
Author

This problem with &service_area= occurs with the &keyword= search. If I leave keyword blank and instead set &category[]=Food Pantries with the search_area the search results are correct.

@monfresh
Copy link
Member

Thanks for reporting this. This is probably due to removing the .uniq at the end of the search method in this commit: ae238e8

I couldn't remember why we needed the .uniq, and all tests passed, so I thought we could remove it, but apparently not. I'll make sure to add a test for this scenario and see if I can reproduce it.

@monfresh
Copy link
Member

I've identified the issue. It happens when the service_area parameter is used and a location has multiple services with service areas that match the search term. No other parameter is required to reproduce this issue. Next step is to figure out how to fix this.

@cderenburger
Copy link
Author

Is it possible to just return the specific service record at the location that matches rather than all the services at the location? For me at least that would be desired behavior. Being able to limit the results to the particular service matching the keyword rather than seeing all the services at the location.

@monfresh
Copy link
Member

Search returns Location objects. What you are seeing in the results is the same Location repeated, not multiple services. The solution is to use group to eliminate duplicates in the service_area query, but it is interfering with the location search due to a known issue with the geocoder gem. I'm trying to figure out the best way to solve this.

@monfresh
Copy link
Member

I just fixed this. Could you grab the latest changes and try it again, please?

@cderenburger
Copy link
Author

This works great here. Thanks @monfresh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants