コード例 #1
0
ファイル: fulltext.py プロジェクト: foamdino/warp
def reindex():
    import storm.database
    orig = storm.database.DEBUG
    storm.database.DEBUG = True
    store.execute("DELETE FROM warp_fulltext")
    for klass in searchModels.itervalues():
        for obj in store.find(klass):
            obj.__storm_flushed__()
    storm.database.DEBUG = orig
コード例 #2
0
ファイル: fulltext.py プロジェクト: foamdino/warp
    def __storm_flushed__(self):
        store.execute(DELETE_SQL, (self.__class__.__name__, self.id))

        if get_obj_info(self).get("store") is not None:
            
            vals = [v for v in self.getSearchVals() if v is not None]

            if vals:
                text = self._searchSeparator.join(vals).encode("utf-8")

                store.execute(INSERT_SQL,
                              (self.__class__.__name__,
                               self.id,
                               self.getSearchLanguage(),
                               text))
        store.commit()
コード例 #3
0
ファイル: setupdb.py プロジェクト: bhomnick/warp
def setup():
    for (table, creationSQL) in tableSpecs:
        if not sql['tableExists'](store, table):
            print "Creating table %s" % table
            store.execute(creationSQL)
            store.commit()
コード例 #4
0
ファイル: setupdb.py プロジェクト: ubolonton/warp
def setup():
    for (table, creationSQL) in tableSpecs:
        if not sql['tableExists'](store, table):
            print "Creating table %s" % table
            store.execute(creationSQL)
            store.commit()
コード例 #5
0
ファイル: fulltext.py プロジェクト: foamdino/warp
def search(term, language='english'):
    for modelName, doc_id in store.execute(SEARCH_SQL, (language, term.encode("utf-8"))):
        model = searchModels[modelName]
        yield store.get(model, doc_id)