com.xpn.xwiki.plugin.lucene
Class IndexRebuilder

java.lang.Object
  extended by com.xpn.xwiki.util.AbstractXWikiRunnable
      extended by 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:

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:

Version:
$Id$

Constructor Summary
IndexRebuilder(IndexUpdater indexUpdater, com.xpn.xwiki.XWikiContext context)
           
 
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
 

Constructor Detail

IndexRebuilder

public IndexRebuilder(IndexUpdater indexUpdater,
                      com.xpn.xwiki.XWikiContext context)
Method Detail

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 index
context - 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.