libertysoft3 / saidit

The reddit open source fork powering SaidIt
https://saidit.net
Other
228 stars 39 forks source link

Subreddit search issues #16

Closed libertysoft3 closed 5 years ago

libertysoft3 commented 5 years ago

As reported this fails: https://saidit.net/s/SaidIt/search?q=vote&sort=top&restrict_sr=on

Edit: also broken:

Works:

wizzwizz4 commented 5 years ago

It's just &sort=top; all other parameters and sorts work fine.

wizzwizz4 commented 5 years ago

And so do other subs.

wizzwizz4 commented 5 years ago

Were upvote and downvote renamed in the database? That could be causing it. They're still addressed by those names in some files, like /r2/r2/lib/subreddit_search.py.

wizzwizz4 commented 5 years ago

I think your issue is that 43a18709cf70a6cb45a10e9692fc05712665f2df didn't change the queries.

wizzwizz4 commented 5 years ago

I was thinking of using git bisect on the test server to find out where the problem was, but the test server doesn't appear to have working search at all… or working pages.

libertysoft3 commented 5 years ago

Thanks for your work on this. So the default sub search is for 'relevance', but on the search results page you get another sort picker with 'top'. If you choose 'top' then you get a 500 error.

wizzwizz4 commented 5 years ago

Yes; as far as I can tell it's only "top" that has the issue. I'm starting to doubt the query explanation, since it looks like they're generated from SQLAlchemy and I can't find any buggy SQLAlchemy-using code.

libertysoft3 commented 5 years ago

resolved by 9ef5ff00bbfafca4cfb36125a3abf0d1f6c8e77b

@wizzwizz4 they were trying to search by field 'top' but that doesn't exist, I had to specify it should use ups and downs to determine top.

wizzwizz4 commented 5 years ago

Argh! I skipped past that because I was looking for a "where" or "sort by" clause.

I'm not sure about lines 316–317; from what I can tell, "link" is the internal Reddit name for links and text posts, so you might've broken something by making it make sense.

libertysoft3 commented 5 years ago

@wizzwizz4, that link search function is for all links, so restricting it to return links only seems appropriate.

Give it a demo on site, it's way saner. Thank you for reviewing my code.

wizzwizz4 commented 5 years ago

Oh, yeah; you're right. It seems to work better now.