From b31cc21d48f349a62a6dc74aef9d46a347fb4f0e Mon Sep 17 00:00:00 2001 From: Marcin Koziej Date: Thu, 27 Oct 2011 16:11:23 +0200 Subject: [PATCH] async indexing, fixes --- apps/search/index.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/search/index.py b/apps/search/index.py index f5489a5ca..60e76a263 100644 --- a/apps/search/index.py +++ b/apps/search/index.py @@ -82,6 +82,7 @@ class Index(IndexStore): def index_book(self, book, overwrite=True): if overwrite: self.remove_book(book) + doc = self.extract_metadata(book) parts = self.extract_content(book) @@ -263,19 +264,15 @@ class ReusableIndex(Index): atexit.register(ReusableIndex.close_reusable) def index_book(self, *args, **kw): - job = ReusableIndex.pool.apply_async(Index.index_book, args, kw) + job = ReusableIndex.pool.apply_async(Index.index_book, (self,)+ args, kw) ReusableIndex.pool_jobs.append(job) @staticmethod def close_reusable(): + import pdb; pdb.set_trace() if ReusableIndex.index is not None: - all_jobs = len(ReusableIndex.pool_jobs) - waited=1 for job in ReusableIndex.pool_jobs: - sys.stdout.write("\rWaiting for search index job: %d/%d..." % job.wait() - waited+=1 - print("Indexing done.") ReusableIndex.pool.close() ReusableIndex.index.optimize() -- 2.20.1