def searchidlist(key, selected=0): """ :param key: :param se: :param selected: :return: """ se = SearchEngine(config_path=CONFIG_PATH, config_encoding='utf-8') flag, id_scores = se.search(key, selected) doc_id = [i for i, s in id_scores] page = [] for i in range(1, (len(doc_id) // 10 + 2)): page.append(i) return flag, page, doc_id
def searchidlist(key, selected=0): """ Get page number and document ids Parameters: key (string): searching keywords selected (int): ranking strategy (0 for BM25, 1 for popularity, 2 for time) Returns: flag (int): found = 1, not found = 0 page (list<int>): list of page numbers doc_id (list<string>): list of document ids """ se = SearchEngine(config_path=CONFIG_PATH, config_encoding='utf-8') flag, id_scores = se.search(key, selected) doc_id = [i for i, s in id_scores] page = [] for i in range(1, (len(doc_id) // 10 + 2)): page.append(i) return flag, page, doc_id