Ejemplo n.º 1
0
def merge_results(*results):
    if g.use_query_cache:
        return merge_cached_results(*results)
    else:
        m = Merge(results, sort=results[0]._sort)
        #assume the prewrap_fn's all match
        m.prewrap_fn = results[0].prewrap_fn
        return m
Ejemplo n.º 2
0
def merge_results(*results):
    if g.use_query_cache:
        return merge_cached_results(*results)
    else:
        m = Merge(results, sort = results[0]._sort)
        #assume the prewrap_fn's all match
        m.prewrap_fn = results[0].prewrap_fn
        return m
Ejemplo n.º 3
0
def merge_results(*results):
    if not results:
        return QueryishList([])
    elif g.use_query_cache:
        return MergedCachedResults(results)
    else:
        m = Merge(results, sort=results[0]._sort)
        #assume the prewrap_fn's all match
        m.prewrap_fn = results[0].prewrap_fn
        return m
Ejemplo n.º 4
0
def merge_results(*results):
    if not results:
        return QueryishList([])
    elif g.use_query_cache:
        return MergedCachedResults(results)
    else:
        m = Merge(results, sort=results[0]._sort)
        # assume the prewrap_fn's all match
        m.prewrap_fn = results[0].prewrap_fn
        return m
Ejemplo n.º 5
0
def merge_results(*results):
    if not results:
        return QueryishList([])
    elif g.use_query_cache:
        return MergedCachedResults(results)
    else:
        assert all((results[0]._sort == r._sort and results[0].prewrap_fn == r.prewrap_fn) for r in results)
        m = Merge(results, sort=results[0]._sort)
        m.prewrap_fn = results[0].prewrap_fn
        return m
Ejemplo n.º 6
0
def merge_results(*results):
    if not results:
        return QueryishList([])
    elif g.use_query_cache:
        return MergedCachedResults(results)
    else:
        assert all((results[0]._sort == r._sort
                    and results[0].prewrap_fn == r.prewrap_fn)
                   for r in results)
        m = Merge(results, sort = results[0]._sort)
        m.prewrap_fn = results[0].prewrap_fn
        return m
Ejemplo n.º 7
0
 def get_all_mod_ids(srs):
     from r2.lib.db.thing import Merge
     srs = tup(srs)
     queries = [SRMember._query(SRMember.c._thing1_id == sr._id,
                                SRMember.c._name == 'moderator') for sr in srs]
     merged = Merge(queries)
     # sr_ids = [sr._id for sr in srs]
     # query = SRMember._query(SRMember.c._thing1_id == sr_ids, ...)
     # is really slow
     return [rel._thing2_id for rel in list(merged)]