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

API search for facility and pagination #921

dickoa opened this Issue Apr 25, 2017 · 3 comments


5 participants
Copy link

dickoa commented Apr 25, 2017

Hi everyone,

Thanks again for the healthsites project, we really love it at HDX.

I was testing the API and how to search for healthsites by name or placename and found something odd.
When you search by placename the page parameter works well and you have 100 healthsites (or less) per page as documented.

However, when you search healthsites by name, it looks like the pagination doesn't work. For example, this query gives all the healthsites with "chu" in their name (689 healthsites as of 25th April 2017)

I also want to add that it would be great if we can have the number of page in the metadata, a kind of summary or a limit parameter to control the number of healthsites we want per page. I think it is quite related to #920

Thanks again and let me know how I can help



This comment has been minimized.

Copy link

dickoa commented Apr 26, 2017

Hi everyone,

Not sure, but I think we need to modify this part:

Using the same approach for placename i.e:

Let me know if I can do something to help

@markherringer markherringer assigned Gustry and unassigned timlinux Apr 26, 2017


This comment has been minimized.

Copy link

meomancer commented Apr 27, 2017

hi @dickoa
yes, i missed it
the solution from you is correct, i much appreciate if you could update it.


This comment has been minimized.

Copy link

dickoa commented Apr 27, 2017

Just to be sure that we are saying the same thing, shoudl this be sufficient ?

        elif search_type == "facility":
            facilities = Locality.objects.filter(name__icontains=place_name)
                facilities = self.get_query_by_page(facilities,
                facilities = facilities[:100]
            facilities = self.query_to_json(facilities, self.format)
            return self.api_response(facilities)

If yes I can add it ASAP.
I am not a Django dev, so setting up an env will take probably some time.

LeMeteore added a commit to LeMeteore/healthsites that referenced this issue May 1, 2017

@markherringer markherringer added this to Backlog in Papercuts Jul 20, 2017

@timlinux timlinux removed the in progress label Aug 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment