govtrack / govtrack.us-web

The Django source code for the GovTrack.us website.
https://www.govtrack.us
360 stars 75 forks source link

Search should return an exact match of a bill title as the first result #85

Open GPHemsley opened 10 years ago

GPHemsley commented 10 years ago

I'm not sure how search is weighted, but it doesn't seem to prioritize the bill title over other text.

For example, if I search for the "Disaster Relief Appropriations Act, 2013", I should get this bill as the first result:

https://www.govtrack.us/congress/bills/113/hr152

Instead, I get these results, where the correct bill isn't even on the first page:

https://www.govtrack.us/congress/bills/browse?congress=__ALL__&sort=relevance&text=Disaster%20Relief%20Appropriations%20Act,%202013

In fact, even if I narrow the search down to only bills signed by the President, it still only comes up as the second result:

https://www.govtrack.us/congress/bills/browse?congress=__ALL__&sort=relevance&current_status=28&text=Disaster%20Relief%20Appropriations%20Act,%202013

It would be helpful if the search could go straight to the bill page, like it does when you search for "P.L.", but at the very least it should show bill title matches above other matches.

JoshData commented 10 years ago

Agreed. It's not weighted at all now. Not sure but the Field Boost here might do it: https://django-haystack.readthedocs.org/en/latest/boost.html. I'll try that.

JoshData commented 10 years ago

Actually. The default sort order is a modified prognosis score. It ignores relevancy. Any bills in which the words are contained are included in the search results. What I should do instead is use relevancy but boost with the modified prognosis score.