com.xpn.xwiki.plugin.lucene
Class IndexUpdater

java.lang.Object
  extended by com.xpn.xwiki.plugin.lucene.AbstractXWikiRunnable
      extended by com.xpn.xwiki.plugin.lucene.IndexUpdater
All Implemented Interfaces:
java.lang.Runnable, org.xwiki.observation.EventListener

public class IndexUpdater
extends AbstractXWikiRunnable
implements org.xwiki.observation.EventListener

Version:
$Id: $

Field Summary
 int maxQueueSize
          Soft threshold after which no more documents will be added to the indexing queue.
 boolean needInitialBuild
           
 
Constructor Summary
IndexUpdater()
           
 
Method Summary
 void add(com.xpn.xwiki.doc.XWikiDocument document, com.xpn.xwiki.doc.XWikiAttachment attachment, com.xpn.xwiki.XWikiContext context)
           
 void add(com.xpn.xwiki.doc.XWikiDocument document, com.xpn.xwiki.XWikiContext context)
           
 int addAttachmentsOfDocument(com.xpn.xwiki.doc.XWikiDocument document, com.xpn.xwiki.XWikiContext context)
           
 void addObject(com.xpn.xwiki.doc.XWikiDocument document, com.xpn.xwiki.XWikiContext context)
           
 void cleanIndex()
           
 void doExit()
           
 long getActiveQueueSize()
           
 java.util.List<org.xwiki.observation.event.Event> getEvents()
           
 long getLuceneDocCount()
           
 java.lang.String getName()
           
 long getQueueSize()
           
 void init(java.util.Properties config, LucenePlugin plugin, com.xpn.xwiki.XWikiContext context)
           
 void onEvent(org.xwiki.observation.event.Event event, java.lang.Object source, java.lang.Object data)
           
 void run()
          Main loop.
 void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
           
 void setIndexDir(java.lang.String indexDir)
           
 
Methods inherited from class com.xpn.xwiki.plugin.lucene.AbstractXWikiRunnable
cleanupXWikiContainer, initXWikiContainer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxQueueSize

public int maxQueueSize
Soft threshold after which no more documents will be added to the indexing queue. When the queue size gets larger than this value, the index rebuilding thread will sleep chuks of IndexRebuilder.retryInterval milliseconds until the queue size will get back bellow this threshold. This does not affect normal indexing through wiki updates.


needInitialBuild

public boolean needInitialBuild
Constructor Detail

IndexUpdater

public IndexUpdater()
Method Detail

doExit

public void doExit()

run

public void run()
Main loop. Polls the queue for documents to be indexed.

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

setIndexDir

public void setIndexDir(java.lang.String indexDir)
Parameters:
indexDir - The indexDir to set.

setAnalyzer

public void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
Parameters:
analyzer - The analyzer to set.

init

public void init(java.util.Properties config,
                 LucenePlugin plugin,
                 com.xpn.xwiki.XWikiContext context)

cleanIndex

public void cleanIndex()

add

public void add(com.xpn.xwiki.doc.XWikiDocument document,
                com.xpn.xwiki.XWikiContext context)

addObject

public void addObject(com.xpn.xwiki.doc.XWikiDocument document,
                      com.xpn.xwiki.XWikiContext context)

add

public void add(com.xpn.xwiki.doc.XWikiDocument document,
                com.xpn.xwiki.doc.XWikiAttachment attachment,
                com.xpn.xwiki.XWikiContext context)

addAttachmentsOfDocument

public int addAttachmentsOfDocument(com.xpn.xwiki.doc.XWikiDocument document,
                                    com.xpn.xwiki.XWikiContext context)

getName

public java.lang.String getName()
Specified by:
getName in interface org.xwiki.observation.EventListener

getEvents

public java.util.List<org.xwiki.observation.event.Event> getEvents()
Specified by:
getEvents in interface org.xwiki.observation.EventListener

onEvent

public void onEvent(org.xwiki.observation.event.Event event,
                    java.lang.Object source,
                    java.lang.Object data)
Specified by:
onEvent in interface org.xwiki.observation.EventListener

getQueueSize

public long getQueueSize()
Returns:
the number of documents in the queue.

getLuceneDocCount

public long getLuceneDocCount()
Returns:
the number of documents Lucene index writer.

getActiveQueueSize

public long getActiveQueueSize()
Returns:
the number of documents in the second queue gave to Lucene.


Copyright © 2004-2009 XWiki. All Rights Reserved.