def search(**kwargs): return solr.get_docs_by_query_with_limit(solr.all_topics_collection(), kwargs['q'], boost='total_authority_f', fields=','.join(TopicModel.fields), qf='topic_txt_en', **sans_q(kwargs))
def get_authors(self, limit=10, offset=None, for_api=False): """ Provides the top authors for a wiki :param limit: number of authors you want :type limit: int :param offset: offset :type offset: int :param for_api: if it's for the api, we add less :type for_api: bool :return: list of author dicts :rtype: list """ solr.get_docs_by_query_with_limit(solr.wiki_user_collection(), 'wiki_id_i:%s' % self.wiki_id, limit=limit, offset=offset, sort='total_page_authority_f desc')
def search(**kwargs): """ Accesses all wikis from database matching a query :return: dict keying wiki name to ids :rtype: dict """ return solr.get_docs_by_query_with_limit(solr.global_collection(), kwargs['q'], fields=','.join(WikiModel.fields), qf='attr_title^300 attr_entities^100 attr_desc^150', **sans_q(kwargs))
def get_users(self, limit=10, offset=None, **kwargs): """ Provides the top users for a wiki :param limit: number of users you want :type limit: int :param offset: offset :type offset: int :return: list of user dicts :rtype: list """ return solr.get_docs_by_query_with_limit(solr.wiki_user_collection(), 'wiki_id_i:%s' % self.wiki_id, limit=limit, offset=offset, sort='total_page_authority_f desc', fields=','.join(UserModel.fields))
def get_pages(self, limit=10, offset=None, **kwargs): """ Gets most authoritative pages for this wiki :param limit: the number of pages you want :type limit: int :param offset: offset :type offset: int :return: a list of page objects if not for api, otherwise an ordereddict :rtype: list|OrderedDict """ return solr.get_docs_by_query_with_limit(solr.collection_for_wiki(self.wiki_id), 'type_s:Page', limit=limit, offset=offset, sort='authority_f desc', fields=','.join(PageModel.fields))
def get_topics(self, limit=10, offset=None, **kwargs): """ Get topics for this wiki :param limit: number of topics to get :type limit: int|None :param offset: offset :type offset: int :return: a list of dicts :rtype: list """ return solr.get_docs_by_query_with_limit(solr.collection_for_wiki(self.wiki_id), 'type_s:Topic', limit=limit, offset=offset, sort='total_authority_f desc', fields=','.join(TopicModel.fields))
def get_wikis(self, limit=10, offset=0, for_api=False): """ Most important wikis for this user Calculated by sum of contribs times global authority :param limit: the limit :type limit: int :param offset: offset :type offset: int :param for_api: if it's for the api, we add less :type for_api: bool :return: an ordereddict of wiki ids to wiki dicts, or a list, for API :rtype: collections.OrderedDict|list """ return solr.get_docs_by_query_with_limit(solr.wiki_user_collection(), 'name_txt_en:%s' % self.user_name, limit=limit, offset=offset, boost='scaled_contribs_authority_f')
def get_pages(self, limit=10, offset=0, for_api=False): """ Gets top pages for this author calculated by contribs times global authority :param limit: how many you want :type limit: int :param offset: offset :type offset: int :param for_api: if it's for the api, we add less :type for_api: bool :return: a list of dicts :rtype: list """ return solr.get_docs_by_query_with_limit(solr.all_user_pages_collection(), 'name_txt_en:%s' % self.user_name, limit=limit, offset=offset, boost='user_page_authority_f')
def get_pages(self, limit=10, offset=None, for_api=False): """ Gets most authoritative pages for this wiki :param limit: the number of pages you want :type limit: int :param offset: offset :type offset: int :param for_api: if it's for the api, we add less :type for_api: bool :return: a list of page objects if not for api, otherwise an ordereddict :rtype: list|OrderedDict """ return solr.get_docs_by_query_with_limit(solr.collection_for_wiki(self.wiki_id), 'type_s:Page', limit=limit, offset=offset, sort='authority_f desc')
def get_topics(self, limit=10, offset=None, for_api=False): """ Get topics for this wiki :param limit: number of topics to get :type limit: int|None :param offset: offset :type offset: int :param for_api: if it's for the api, we add less :type for_api: bool :return: a list of dicts :rtype: list """ return solr.get_docs_by_query_with_limit(solr.collection_for_wiki(self.wiki_id), 'type_s:Topic', limit=limit, ofset=offset, sort='total_authority_f desc')
def get_pages(self, limit=10, offset=0, **kwargs): """ Gets top pages for this user calculated by contribs times global authority :param limit: how many you want :type limit: int :param offset: offset :type offset: int :return: a list of dicts :rtype: list """ return solr.get_docs_by_query_with_limit(solr.all_user_pages_collection(), 'user_id_i:%d' % self.user_id, limit=limit, offset=offset, boost='user_page_authority_f', fields=','.join(PageModel.fields), **sans_q(kwargs))
def get_wikis(self, limit=10, offset=0, **kwargs): """ Most important wikis for this user Calculated by sum of contribs times global authority :param limit: the limit :type limit: int :param offset: offset :type offset: int :return: an ordereddict of wiki ids to wiki dicts, or a list, for API :rtype: collections.OrderedDict|list """ return solr.get_docs_by_query_with_limit(solr.wiki_user_collection(), 'user_id_i:%d' % self.user_id, limit=limit, offset=offset, boost='scaled_contribs_authority_f', fields='wiki_id_i', **sans_q(kwargs))
def get_pages(self, limit=10, offset=None, **kwargs): """ Gets most authoritative pages for a topic using Authority DB and Wikia API data :param limit: Number of results we want :type limit: int :param offset: offset :type offset: int :return: a list of objects reflecting page results :rtype: list """ collection = solr.all_pages_collection() return solr.get_docs_by_query_with_limit(collection, self.topic, limit=limit, offset=offset, boost='scaled_authority_f', fields=','.join(PageModel.fields), **sans_q(kwargs))
def get_users(self, limit=10, offset=0, **kwargs): """ Gets users for a given topic :param limit: the number of users we want :type limit: int :param offset: offset :type offset: int :return: a list of objects related to authors :rtype: list """ collection = solr.user_collection() return solr.get_docs_by_query_with_limit(collection, self.topic, limit=limit, offset=offset, boost='scaled_authority_f', fields=','.join(UserModel.fields), **sans_q(kwargs))
def get_pages(self, limit=10, offset=None, for_api=False): """ Gets most authoritative pages for a topic using Authority DB and Wikia API data :param limit: Number of results we want :type limit: int :param offset: offset :type offset: int :param for_api: if it's for the api, we add less :type for_api: bool :return: a list of objects reflecting page results :rtype: list """ collection = solr.all_pages_collection() return solr.get_docs_by_query_with_limit(collection, self.topic, limit=limit, offset=offset, boost='scaled_authority_f')
def get_wikis(self, limit=10, offset=0, for_api=False): """ Gets wikis for the current topic :param limit: the number of wikis we want :type limit: int :param offset: offset :type offset: int :param for_api: if it's for the api, we add less :type for_api: bool :return: a dict with keys for wikis (objects) and wiki ids (ints) for ordering or an ordered list of dicts :rtype: dict|list """ collection = solr.global_collection() return solr.get_docs_by_query_with_limit(collection, self.topic, limit=limit, offset=offset, boost='scaled_authority_f')
def get_users(self, limit=10, offset=0, for_api=False): """ Gets users for a given topic :param limit: the number of users we want :type limit: int :param offset: offset :type offset: int :param for_api: if it's for the api, we add less :type for_api: bool :return: a list of objects related to authors :rtype: list """ collection = solr.user_collection() return solr.get_docs_by_query_with_limit(collection, self.topic, limit=limit, offset=offset, boost='scaled_authority_f')
def get_wikis(self, limit=10, offset=0, **kwargs): """ Gets wikis for the current topic :param limit: the number of wikis we want :type limit: int :param offset: offset :type offset: int :return: a dict with keys for wikis (objects) and wiki ids (ints) for ordering or an ordered list of dicts :rtype: dict|list """ collection = solr.global_collection() return solr.get_docs_by_query_with_limit(collection, self.topic, limit=limit, offset=offset, boost='scaled_authority_f', qf='attr_title^300 attr_entities^100 attr_desc^150', fields=','.join(WikiModel.fields), **sans_q(kwargs))
def get_users(self, limit=10, offset=0, **kwargs): """ Get the most authoritative users for this page :param limit: the number of users you want :type limit: int :param offset: offset :type offset: int :return: a list of of user dicts in order of authority :rtype: list """ return solr.get_docs_by_query_with_limit( solr.collection_for_wiki(self.wiki_id), 'type_s:PageUser AND doc_id_s:%s' % (self.doc_id), limit=limit, offset=offset, boost='contribs_f', fields=','.join(UserModel.fields), **sans_q(kwargs) )
def get_users(self, limit=10, offset=0, for_api=False): """ Get the most authoritative users for this page :param limit: the number of users you want :type limit: int :param offset: offset :type offset: int :param for_api: if it's for the api, we add less :type for_api: bool :return: a list of of user dicts in order of authority :rtype: list """ return solr.get_docs_by_query_with_limit( solr.collection_for_wiki(self.wiki_id), 'type_s:PageUser AND doc_id_s:%s_%s' % (str(self.wiki_id), str(self.page_id)), limit=limit, offset=offset, boost='contribs_f' )
def search(**kwargs): return solr.get_docs_by_query_with_limit(solr.user_collection(), kwargs['q'], boost='scaled_authority_f', fields=','.join(UserModel.fields), **sans_q(kwargs))