Пример #1
0
 def infoChanged(self, obj):
     if toIndex(obj):
         #print "...indexing..."
         rc = RepozeCatalog()
         # I dont want to reindex Material, it takes soo long
         rc.reindex(obj,False)
         rc.closeConnection()
Пример #2
0
 def deleted(self, obj, oldOwner):
     #print "___DELETED CALL OBJ=",obj, oldOwner
     if toIndex(obj):
         rc = RepozeCatalog()
         # Use recursion
         rc.unindexObject(obj, True)
         #oldOwner._notify('deleted', obj)            
         rc.closeConnection() 
Пример #3
0
 def _handleSet(self):
     conference.ConferenceKeywordsModification._handleSet(self)
     if toIndex(self._target):
         rc = RepozeCatalog()
         rc.unindexObject(self._target)
         rc.indexObject(self._target)
         rc.closeConnection()
Пример #4
0
 def infoChanged(self, obj):
     #print "___INFO CHANGED", obj
     if toIndex(obj):
         rc = RepozeCatalog()
         rc.unindexObject(obj)
         rc.indexObject(obj)
         rc.closeConnection()
Пример #5
0
    def getResults(self, query=None):
        res = []
        params = self.params

        if params.get('id', None):
            event = ch.getById(params['id'])
            res.append(event)
            return 1, res

        if not query:
            query = self.getQuery()

        if not query:
            return 0, []

        collections = params.get('collections', 'Conference')
        rc = RepozeCatalog()
        if collections == 'Material':
            rc = RepozeCatalog(matCatalog)
        if collections == 'Contribution':
            rc = RepozeCatalog(contribCatalog)

        catalog = rc.catalog
        ch = ConferenceHolder()
        desc = params.get('desc', False)
        sort_field = params.get('sort_field', 'startDate')

        numdocs, results = catalog.query(query,
                                         sort_index=sort_field,
                                         reverse=desc,
                                         limit=params.get('limit', 5000))
        results = [
            catalog.document_map.address_for_docid(result)
            for result in results
        ]

        if params.get('onlyFids', False):
            return numdocs, results
        else:
            for obj in results:
                try:
                    confId = str(obj).split("|")[0]
                    event = ch.getById(confId)
                    res.append(event)
                except:
                    pass

        return numdocs, res
Пример #6
0
 def _handleSet(self):
     conference.ConferenceKeywordsModification._handleSet(self)
     if toIndex(self._target):            
         rc = RepozeCatalog()
         rc.unindexObject(self._target)
         rc.indexObject(self._target)            
         rc.closeConnection()        
Пример #7
0
 def infoChanged(self, obj):
     #print "___INFO CHANGED", obj
     if toIndex(obj):
         rc = RepozeCatalog()
         rc.unindexObject(obj)
         rc.indexObject(obj)
         rc.closeConnection()
Пример #8
0
    def protectionChanged(self, obj, oldProtection, newProtection):
        if toIndex(obj):
            rc = RepozeCatalog()
            if obj.hasAnyProtection():
                rc.unindexObject(obj)
            else:
                rc.indexObject(obj)

            rc.closeConnection()
        #print "PROT CHANGE. FROM", oldProtection , " TO",newProtection
        pass
Пример #9
0
 def protectionChanged(self, obj, oldProtection, newProtection):
     if toIndex(obj):
         rc = RepozeCatalog()
         if obj.hasAnyProtection():
             rc.unindexObject(obj) 
         else:
             rc.indexObject(obj)
                        
         rc.closeConnection()
     #print "PROT CHANGE. FROM", oldProtection , " TO",newProtection
     pass
Пример #10
0
 def deleted(self, obj, oldOwner):
     #print "___DELETED CALL OBJ=",obj, oldOwner
     if toIndex(obj):
         rc = RepozeCatalog()
         # Use recursion
         rc.unindexObject(obj, True)
         #oldOwner._notify('deleted', obj)
         rc.closeConnection()
Пример #11
0
 def created(self, obj, owner):
     if toIndex(obj):
         rc = RepozeCatalog()
         #obj.md5 = self.getHash(obj)
         rc.index(obj)
         rc.closeConnection()
Пример #12
0
 def deleted(self, obj, oldOwner):
     if toIndex(obj):
         rc = RepozeCatalog()
         rc.unindex(obj)
         rc.closeConnection()        
Пример #13
0
from MaKaC.conference import CategoryManager, ConferenceHolder
#from MaKaC.plugins.base import PluginsHolder
from indico.ext.search.repozer import Utils as ut
#from indico.ext.search.repozer.options import typesToIndex
from indico.ext.search.repozer.repozeIndexer import RepozeCatalog
from repoze.catalog.query import *
import transaction
from datetime import datetime

############################################
# CHANGE HERE if you want to index Materials
# BEWARE: This will increase your Data.fs
############################################

db.DBMgr.getInstance().startRequest()
rc = RepozeCatalog()


def buildCatalog():
    #rc.init_catalog() # Forces index rebuild
    cm = CategoryManager()
    ch = ConferenceHolder()
    totnum = len(ch.getValuesToList())
    curnum = 0
    curper = 0

    startFrom = 0

    print "Events found:", totnum

    for c in ch.getValuesToList():
Пример #14
0
 def eventTitleChanged(self, obj, oldTitle, newTitle):
     if toIndex(obj):
         rc = RepozeCatalog()
         rc.reindex(obj)
         rc.closeConnection()
Пример #15
0
 def eventDatesChanged(cls, obj, oldStartDate, oldEndDate, newStartDate, newEndDate):
     if toIndex(obj):
         rc = RepozeCatalog()
         rc.reindex(obj)
         rc.closeConnection()                          
Пример #16
0
 def moved(self, obj, fromOwner, toOwner):
     if toIndex(obj):
         rc = RepozeCatalog()
         rc.reindex(obj)
         rc.closeConnection()
Пример #17
0
 def _handleSet(self):
     if toIndex(obj):
         conference.ConferenceKeywordsModification._handleSet(self)
         rc = RepozeCatalog()
         rc.reindex(self._target)
         rc.closeConnection()