com.xpn.xwiki.plugin.lucene
Class IndexRebuilder
java.lang.Object
com.xpn.xwiki.util.AbstractXWikiRunnable
com.xpn.xwiki.plugin.lucene.IndexRebuilder
- All Implemented Interfaces:
- Runnable
public class IndexRebuilder
- extends com.xpn.xwiki.util.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$
|
Method Summary |
protected int |
addTranslationOfDocument(org.xwiki.model.reference.DocumentReference documentReference,
String language,
com.xpn.xwiki.XWikiContext wikiContext)
|
protected void |
addTranslationOfDocument(com.xpn.xwiki.doc.XWikiDocument document,
com.xpn.xwiki.XWikiContext wikiContext)
|
org.apache.lucene.search.Searcher |
createSearcher(org.apache.lucene.store.Directory directory,
com.xpn.xwiki.XWikiContext context)
|
protected int |
indexWiki(String wikiName,
com.xpn.xwiki.XWikiContext context)
Adds the content of a given wiki to the indexUpdater's queue. |
boolean |
isIndexed(org.xwiki.model.reference.DocumentReference documentReference,
org.apache.lucene.search.Searcher searcher)
|
boolean |
isIndexed(org.xwiki.model.reference.DocumentReference documentReference,
String version,
String language,
org.apache.lucene.search.Searcher searcher)
|
protected void |
runInternal()
|
int |
startIndex(Collection<String> wikis,
String hqlFilter,
boolean clearIndex,
boolean onlyNew,
com.xpn.xwiki.XWikiContext context)
|
int |
startRebuildIndex(com.xpn.xwiki.XWikiContext context)
|
| Methods inherited from class com.xpn.xwiki.util.AbstractXWikiRunnable |
cleanupExecutionContext, initExecutionContext, run |
| 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)
startIndex
public int startIndex(Collection<String> wikis,
String hqlFilter,
boolean clearIndex,
boolean onlyNew,
com.xpn.xwiki.XWikiContext context)
runInternal
protected void runInternal()
- Specified by:
runInternal in class com.xpn.xwiki.util.AbstractXWikiRunnable
indexWiki
protected int indexWiki(String wikiName,
com.xpn.xwiki.XWikiContext context)
throws InterruptedException
- Adds the content of a given wiki to the indexUpdater's queue.
- Parameters:
wikiName - the name of the wiki to indexcontext - the XWiki context
- Returns:
- the number of indexed elements
- Throws:
InterruptedException
addTranslationOfDocument
protected int addTranslationOfDocument(org.xwiki.model.reference.DocumentReference documentReference,
String language,
com.xpn.xwiki.XWikiContext wikiContext)
throws com.xpn.xwiki.XWikiException,
InterruptedException
- Throws:
com.xpn.xwiki.XWikiException
InterruptedException
addTranslationOfDocument
protected void addTranslationOfDocument(com.xpn.xwiki.doc.XWikiDocument document,
com.xpn.xwiki.XWikiContext wikiContext)
isIndexed
public boolean isIndexed(org.xwiki.model.reference.DocumentReference documentReference,
org.apache.lucene.search.Searcher searcher)
isIndexed
public boolean isIndexed(org.xwiki.model.reference.DocumentReference documentReference,
String version,
String language,
org.apache.lucene.search.Searcher searcher)
createSearcher
public org.apache.lucene.search.Searcher createSearcher(org.apache.lucene.store.Directory directory,
com.xpn.xwiki.XWikiContext context)
Copyright © 2004-2011 XWiki. All Rights Reserved.