Beispiel #1
0
 def __init__(self, ixpath, dypypath, dbpath="main.db"):
     if dbpath:
         self.__mainDb = self.__connect(dbpath)
     if not (os.path.exists(ixpath)):
         os.makedirs(ixpath)
     self.__storage = FileStorage(ixpath)
     self.__ixpath = ixpath
     self.__dypypath = dypypath
     pass
Beispiel #2
0
    def load(self):
        """
            Load the Index from the path ixpath
            return self.OK = True if success
        """
        ix, ok = None, False
        if index.exists_in(self._ixpath):
            storage = FileStorage(self._ixpath)
            ix = storage.open_index()
            ok = True

        return ix, ok
Beispiel #3
0
    def __init__(self, pathindex, pathstore):
        self.pathindex = pathindex
        self.pathstore = pathstore

        if not os.path.exists(pathindex):
            os.mkdir(pathindex)

        storage = FileStorage(pathindex)
        if not index.exists(storage):
            self.index = storage.create_index(self.schema)
        else:
            self.index = storage.open_index()