class SoPaperSearcher(object): """ Search by content of paper Don't instantiate me """ __metaclass__ = Singleton def __init__(self): if not os.path.isdir(DB_DIR): SoPaperIndexer().rebuild() self.searcher = XapianSearcher(DB_DIR) def search(self, query, offset=0, page_size=ukconfig.SEARCH_PAGE_SIZE, summary_len=ukconfig.SEARCH_SUMMARY_LEN): res = self.searcher.search(query, offset, page_size, summary_len) return res
def __init__(self): if not os.path.isdir(DB_DIR): SoPaperIndexer().rebuild() self.searcher = XapianSearcher(DB_DIR)