JustZack / audit-congress

A website collecting & displaying information about the activities of congress.
0 stars 0 forks source link

Make searches broad & performant #72

Open JustZack opened 4 months ago

JustZack commented 4 months ago

Two things that don't go together well usually.

For example: If I am looking for a bill about boeing, id expect the search to look at all bill subjects and bill titles. The query would be something like: select b.*, bt.title, bs.subject from bills b join billtitles bt on b.id = bt.billId join billsubjects bs on b.id = bs.billId where (bt.title like "%boeing%" or bs.subject like "%boeing%") group by b.id order by bt.billId, bs.billId desc

however, this takes 30 seconds to retrieve 9 bills. Id have to guess this is why congress.gov gets slow too. Adding a congress requirement makes this significantly faster due to indexes, but thats not what I'm going for.

Apply this thinking to member/bill/vote/etc type searches. Consider how an average person with zero knowledge would look up something VS somebody who understands congress sessions & bill types.

JustZack commented 4 months ago

Heres a thought, congress IS a requirement but the queries split under the hood by congress to avoid significant hangs. I.E. searching for boeing without a congress defined would actually result in ((sequantial)) queries against each congress, probably in separate API calls so information can populate quickly.

Would also be able to cache the query result by congress VS generally