Example #1
0
 def run(self):
     pqueue = self.postingqueue
     
     index = self.storage.open_index(self.indexname)
     writer = SegmentWriter(index, name=self.segmentname, lock=False, **self.kwargs)
     
     while self.running:
         args = pqueue.get()
         if args is None:
             break
         
         writer.add_document(**args)
     
     if not self.running:
         writer.cancel()
         self.terminate()
     else:
         writer.pool.finish(writer.docnum, writer.lengthfile,
                            writer.termsindex, writer.postwriter)
         self._segment = writer._getsegment()
Example #2
0
 def cancel(self):
     try:
         for task in self.tasks:
             task.cancel()
     finally:
         SegmentWriter.cancel(self)
Example #3
0
 def cancel(self):
     try:
         for task in self.tasks:
             task.cancel()
     finally:
         SegmentWriter.cancel(self)