mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 23:39:11 -05:00
Terrible hack for PG-9 support.
Remove as soon as /r/all is precomputed.
This commit is contained in:
@@ -894,6 +894,7 @@ class Query(object):
|
||||
self._limit = kw.get('limit')
|
||||
self._data = kw.get('data')
|
||||
self._sort = kw.get('sort', ())
|
||||
self._filter_primary_sort_only = kw.get('filter_primary_sort_only', False)
|
||||
|
||||
self._filter(*rules)
|
||||
|
||||
@@ -934,8 +935,16 @@ class Query(object):
|
||||
|
||||
def _dir(self, thing, reverse):
|
||||
ors = []
|
||||
|
||||
# this fun hack lets us simplify the query on /r/all
|
||||
# for postgres-9 compatibility. please remove it when
|
||||
# /r/all is precomputed.
|
||||
sorts = range(len(self._sort))
|
||||
if self._filter_primary_sort_only:
|
||||
sorts = [0]
|
||||
|
||||
#for each sort add and a comparison operator
|
||||
for i in range(len(self._sort)):
|
||||
for i in sorts:
|
||||
s = self._sort[i]
|
||||
|
||||
if isinstance(s, operators.asc):
|
||||
|
||||
@@ -774,7 +774,8 @@ class AllSR(FakeSubreddit):
|
||||
read_cache = True,
|
||||
write_cache = True,
|
||||
cache_time = 60,
|
||||
data = True)
|
||||
data = True,
|
||||
filter_primary_sort_only=True)
|
||||
if time != 'all':
|
||||
q._filter(queries.db_times[time])
|
||||
return q
|
||||
|
||||
Reference in New Issue
Block a user