com.xpn.xwiki.plugin.lucene
Class IndexRebuilder
java.lang.Object
com.xpn.xwiki.plugin.lucene.AbstractXWikiRunnable
com.xpn.xwiki.plugin.lucene.IndexRebuilder
- All Implemented Interfaces:
- java.lang.Runnable
public class IndexRebuilder
- extends AbstractXWikiRunnable
Handles rebuilding of the whole Lucene Search Index. This involves the following steps:
- empty the existing index
- retrieve the names of all virtual wikis
- foreach document in each virtual wiki:
- index the document
- get and index all translations of the document
- get and index all attachments of the document
- get and index all objects of the document
The rebuild can be triggered using the LucenePluginApi.rebuildIndex() method of the
LucenePluginApi. Once a rebuild request is made, a new thread is created, so the
requesting script can continue processing, while the rebuilding is done in the background. The
actual indexing is done by the IndexUpdater thread, this thread just gathers the data and passes
it to the IndexUpdater.
As a summary, this plugin:
- cleans the Lucene search indexes and re-submits all the contents of all the wikis for
indexing
- without clogging the indexing thread (since 1.2)
- all in a background thread (since 1.2)
- making sure that only one rebuild is in progress (since 1.2)
- Version:
- $Id: IndexRebuilder.java 24078 2009-09-27 02:37:41Z sdumitriu $
|
Method Summary |
protected int |
addTranslationsOfDocument(com.xpn.xwiki.doc.XWikiDocument document,
com.xpn.xwiki.XWikiContext wikiContext)
|
protected int |
indexWiki(java.lang.String wikiName,
com.xpn.xwiki.XWikiContext context)
Adds the content of a given wiki to the indexUpdater's queue. |
void |
run()
|
int |
startRebuildIndex(com.xpn.xwiki.XWikiContext context)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IndexRebuilder
public IndexRebuilder(IndexUpdater indexUpdater,
com.xpn.xwiki.XWikiContext context)
startRebuildIndex
public int startRebuildIndex(com.xpn.xwiki.XWikiContext context)
run
public void run()
indexWiki
protected int indexWiki(java.lang.String wikiName,
com.xpn.xwiki.XWikiContext context)
- Adds the content of a given wiki to the indexUpdater's queue.
- Parameters:
wikiName - context -
- Returns:
addTranslationsOfDocument
protected int addTranslationsOfDocument(com.xpn.xwiki.doc.XWikiDocument document,
com.xpn.xwiki.XWikiContext wikiContext)
Copyright © 2004-2009 XWiki. All Rights Reserved.