Пример #1
0
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
Пример #2
0
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
Пример #3
0
 def __init__(self):
     if not os.path.isdir(DB_DIR):
         SoPaperIndexer().rebuild()
     self.searcher = XapianSearcher(DB_DIR)
Пример #4
0
 def __init__(self):
     if not os.path.isdir(DB_DIR):
         SoPaperIndexer().rebuild()
     self.searcher = XapianSearcher(DB_DIR)