codeforboston / maple

MAPLE makes it easy for anyone to view and submit testimony to the Massachusetts Legislature about the bills that will shape our future.
https://mapletestimony.org
MIT License
44 stars 118 forks source link

Add search to bills page #318

Closed alexjball closed 2 years ago

alexjball commented 2 years ago

closes #249, closes #301

This adds a "search by" dropdown and a search box. Users can search by bill title/id/pinslip; city; current committee name/id; and lead sponsor name/id/district. Will add filter for my legislators in a followup PR

The search runs entirely on the client. The backend generates an index of all the bills every day. The client downloads this index and searches it using Fuse.js. The selected value is then used as a filter in the main bill table. So this handles both the search and filter use cases.

github-actions[bot] commented 2 years ago

Visit the preview URL for this PR (updated for commit alexjball/advocacy-maps@eba723c):

https://digital-testimony-dev--pr318-search-gmv39dbr.web.app

(expires Tue, 29 Mar 2022 22:01:46 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bc0858669d4997df2a9165c2144bd1e2dbba0242

alexjball commented 2 years ago

Fixing some deployment things, the link doesn't yet work

jkoren commented 2 years ago

Alex, This looks amazing! One small thing, I noticed that there is an "undefined" in one of the results. I will keep on looking at it. image

jkoren commented 2 years ago

This isn't a showstopper, but I noticed that if you filter by a Lead Sponsor it works fine, but if you go back to Search By: None, the filter stays on.

https://user-images.githubusercontent.com/67333843/159573893-2c12a699-438c-4d44-988e-3a9ab1de9048.mov

jkoren commented 2 years ago

I noticed that if you do a filter, and then add a sort, there are no results. For example, I filtered on lead sponsor = "Adrian Madaro" and then sorted by # CoSponsors, and I got no results.

https://user-images.githubusercontent.com/67333843/159574927-86268567-17f9-45b8-bed3-fad5e2eca7d9.mov

alexjball commented 2 years ago

Thanks for the review, Jeff! We need a bunch of indexes for this feature. Each combination of search by and sort by needs one. Now that they're built sorting and filtering works. Also addressed your other comments.