API V1 bill search not yielding results found in browser search


#1

CA AB 3109 can be found on OpenStates when searching simply for “AB 3109”.

https://openstates.org/all/bills/?search_text=AB+3109

When using the API, I get no results for either of the following queries:

https://openstates.org/api/v1/bills/?apikey={key}&q=AB+3109&st=CA
https://openstates.org/api/v1/bills/?apikey={key}&q=AB+3109

The latter is more representative of what I’m doing in the browser, but I thought adding a state might help in case the issue was related to situations where the API will essentially return nothing when you don’t give a state because the result set is too large. That doesn’t seem to be a factor here, though. I don’t get a 400-type response in either case. I get a literal, empty JSON array back as the response in both examples.

Am I missing something in my expectations and/or execution?


#2

Ah, right now the search in the API is using a keyword search, whereas the site had special handling for things that look like bill ids.

But, weird timing- the site just changed (as of tonight in fact)

The new site will gain a wide search soon based upon the API logic, but if you’re interested in the q= query adding functionality a feature request on https://github.com/openstates/openstates.org would be welcome


#3

The application I work on provides a way to search OpenStates via the API. It has been simply passing user query text along as the q parameter to bills search. A user who was able to find many bills using this feature in the past was suddenly unable to find one recently which got me wondering about possible regressions or some such.

It looks like I will want to use the bill_id parameter if we have something like “AB 3109” to search on.

http://docs.openstates.org/en/latest/api/bills.html#bill-search

From an end user perspective, I think it’s counterintuitive that these bill ID strings aren’t considered when doing keyword search, but perhaps I’m just ignorant and/or lazy.


#4

agree, I think these should be searched w/ the q param, mind filing a ticket?