'Search torrent
:param query: dict
:param query[\'category_id\']: Int optional
:param query[\'result_per_page\']: Int optional
:param query[\'page_index\']: Int optional
:param query[\'terms\']: (Term type id, Term id,)
:return dict'

@auth_required
def search(self, query):

    url = T411API_SEARCH_PATH
    if (query.get(u'expression') is not None):
        url += query[u'expression']
    url_params = {}
    if (query.get(u'category_id') is not None):
        url_params[u'cid'] = query[u'category_id']
    if (query.get(u'result_per_page') is not None):
        url_params[u'limit'] = query[u'result_per_page']
    if (query.get(u'page_index') is not None):
        url_params[u'offset'] = query[u'page_index']
    if (query.get(u'terms') is not None):
        for (term_type_id, term_id) in query[u'terms']:
            term_type_key_param = (u'term[%s][]' % term_type_id)
            if (url_params.get(term_type_key_param) is None):
                url_params[term_type_key_param] = []
            url_params[term_type_key_param].append(term_id)
    return self.get_json(url, params=url_params)
