com.xpn.xwiki.plugin.lucene
Class IndexUpdater

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

public class IndexUpdater
extends com.xpn.xwiki.util.AbstractXWikiRunnable
implements org.xwiki.observation.EventListener

Version:
$Id$

Method Summary
 void addAttachment(com.xpn.xwiki.doc.XWikiDocument document, String attachmentName, com.xpn.xwiki.XWikiContext context, boolean deleted)
           
 void addWiki(String wikiId, boolean deleted)
           
 void cleanIndex()
           
 void doExit()
           
 org.apache.lucene.store.Directory getDirectory()
          Return a reference to the directory that this updater is currently working with.
 List<org.xwiki.observation.event.Event> getEvents()
          
 long getLuceneDocCount()
           
 int getMaxQueueSize()
           
 String getName()
          
 long getQueueSize()
           
 void onEvent(org.xwiki.observation.event.Event event, Object source, Object data)
          
protected  org.apache.lucene.index.IndexWriter openWriter(boolean create)
           
 void queueAttachment(com.xpn.xwiki.doc.XWikiAttachment attachment, com.xpn.xwiki.XWikiContext context, boolean deleted)
           
 int queueAttachments(com.xpn.xwiki.doc.XWikiDocument document, com.xpn.xwiki.XWikiContext context)
           
 void queueDocument(com.xpn.xwiki.doc.XWikiDocument document, com.xpn.xwiki.XWikiContext context, boolean deleted)
           
protected  void runInternal()
          Main loop.
 void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
           
 
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
 

Method Detail

doExit

public void doExit()

getDirectory

public org.apache.lucene.store.Directory getDirectory()
Return a reference to the directory that this updater is currently working with.


runInternal

protected void runInternal()
Main loop. Polls the queue for documents to be indexed.

Specified by:
runInternal in class com.xpn.xwiki.util.AbstractXWikiRunnable
See Also:
Runnable.run()

openWriter

protected org.apache.lucene.index.IndexWriter openWriter(boolean create)
                                                  throws IOException
Throws:
IOException

setAnalyzer

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

cleanIndex

public void cleanIndex()

queueDocument

public void queueDocument(com.xpn.xwiki.doc.XWikiDocument document,
                          com.xpn.xwiki.XWikiContext context,
                          boolean deleted)

queueAttachment

public void queueAttachment(com.xpn.xwiki.doc.XWikiAttachment attachment,
                            com.xpn.xwiki.XWikiContext context,
                            boolean deleted)

addAttachment

public void addAttachment(com.xpn.xwiki.doc.XWikiDocument document,
                          String attachmentName,
                          com.xpn.xwiki.XWikiContext context,
                          boolean deleted)

addWiki

public void addWiki(String wikiId,
                    boolean deleted)

queueAttachments

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

getName

public String getName()

Specified by:
getName in interface org.xwiki.observation.EventListener
See Also:
EventListener.getName()

getEvents

public List<org.xwiki.observation.event.Event> getEvents()

Specified by:
getEvents in interface org.xwiki.observation.EventListener
See Also:
EventListener.getEvents()

onEvent

public void onEvent(org.xwiki.observation.event.Event event,
                    Object source,
                    Object data)

Specified by:
onEvent in interface org.xwiki.observation.EventListener
See Also:
EventListener.onEvent(org.xwiki.observation.event.Event, java.lang.Object, java.lang.Object)

getQueueSize

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

getLuceneDocCount

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

getMaxQueueSize

public int getMaxQueueSize()


Copyright © 2004-2011 XWiki. All Rights Reserved.