'Helper function for interfacing with search.  Basically a
thin wrapper for SearchBuilder.'

def _search(self, query_obj, num, after, reverse, count=0, type=None, skip_deleted_authors=True, sr_detail=False, heading=None, nav_menus=None, legacy_render_class=True):

    if legacy_render_class:
        builder_wrapper = self._legacy_search_builder_wrapper()
    else:
        builder_wrapper = self._search_builder_wrapper(query_obj)
    builder = SearchBuilder(query_obj, after=after, num=num, reverse=reverse, count=count, wrap=builder_wrapper, skip_deleted_authors=skip_deleted_authors, sr_detail=sr_detail)
    if (after and (not builder.valid_after(after))):
        g.stats.event_count('listing.invalid_after', 'search')
        self.abort403()
    params = request.GET.copy()
    if type:
        params['type'] = type
    listing = SearchListing(builder, show_nums=True, params=params, heading=heading, nav_menus=nav_menus)
    try:
        res = listing.listing(legacy_render_class)
    except g.search.SearchException as e:
        return self.search_fail(e)
    return res
