--- cdli/cdli_files.py 2006/11/15 13:57:13 1.52 +++ cdli/cdli_files.py 2006/12/22 11:56:08 1.53 @@ -21,7 +21,7 @@ from ZPublisher.HTTPRequest import HTTPR from ZPublisher.HTTPResponse import HTTPResponse from ZPublisher.BaseRequest import RequestContainer import threading - +from BTrees.OOBTree import OOBTree class BasketContent(SimpleItem): """classe fuer den Inhalt eines Baskets""" @@ -1862,6 +1862,56 @@ class CDLIRoot(Folder): meta_type="CDLIRoot" downloadCounterBaskets=0# counts the current basket downloads if counter > 10 no downloads are possible + def showInLineIndex(self): + """get the index for debug purposes""" + print "show" + for x in self.lineIndex.iterkeys(): + print "word:",x + for y in self.lineIndex[x].iterkeys(): + print "doc",y,self.lineIndex[x][y] + + return self.lineIndex + + def searchInLineIndexDocs(self,word): + """search occurences""" + return list(self.lineIndex.get(word.upper()).keys()) + + def getLinesFromIndex(self,word,doc): + """get lines""" + return self.lineIndex[word][doc] + + def cleanInLineIndex(self): + """delete InlineIndex""" + for x in list(self.lineIndex.keys()): + del(self.lineIndex[x]) + print [x for x in self.lineIndex.keys()] + + return "ok" + + def storeInLineIndex(self,key,value): + """store in index""" + + if (not hasattr(self,'lineIndex')) or (type(self.lineIndex) is DictType): + self.lineIndex=OOBTree() + li=self.lineIndex + + if li.has_key(key): + + if li[key].has_key(value[0]) and (not (value[1] in li[key][value[0]])): + li[key][value[0]].append(value[1]) # add it if now in the array + else: + li[key][value[0]]=[value[1]] # new array for lines + + else: + + li[key]=OOBTree()# new btree for lines + li[key][value[0]]=[value[1]] + + + self.lineIndex=li + + get_transaction().commit() + def showFile(self,fileId): """show a file"""