chandler37 / givegivegave

charity database
Apache License 2.0
1 stars 2 forks source link

charity search API #53

Open chandler37 opened 6 years ago

chandler37 commented 6 years ago

Right now you can only search by EIN (and that may be broken for orgs whose EINs are 8 digits, not 9).

Maybe GET /api/v1/charities?name=red+cross&search_type=inexact and GET /api/v1/charities?full_text=foo&search_type=inexact treating query strings as AND-separated and giving preference to matches found that exactly match the query string (1)

Let's not forget /api/v1/charities?website=give.org?search_type=inexact

And maybe have GET /api/v1/charities?name=american+red+cross&search_type=complete that would match name=="American Red Cross" but not "American Red Cross of Kentucky" or "American Red Cross Inc."

We'll need pagination, perhaps https://github.com/kaminari/kaminari, unless we deploy a search backend #54 which we should do so we don't make postgres grind to a halt doing table scans and so we get insanely better information retrieval (search quality). If we do use a backend like that, it'd be nice to make it optional, doing table scans by default.

(1) "red cross" exactly matches "american red cross" but not "cross of red", an inexact match

chandler37 commented 6 years ago

57 has created an angolia index. We need to use it for backend search but many users will prefer to use algolia's javascript API to speak directly to them.

chandler37 commented 6 years ago

58 uses algolia for backend search. It just uses one 'search' param, though, different than above. For exact matches, or close to them, use double quotes.

Still TODO: pagination