com.ecyrd.jspwiki.search
Class LuceneSearchProvider

java.lang.Object
  extended by com.ecyrd.jspwiki.search.LuceneSearchProvider
All Implemented Interfaces:
SearchProvider, WikiProvider

public class LuceneSearchProvider
extends Object
implements SearchProvider

Interface for the search providers that handle searching the Wiki

Since:
2.2.21.
Author:
Arent-Jan Banck for Informatica

Field Summary
protected static org.apache.log4j.Logger log
           
static int LUCENE_OPTIMIZE_COUNT
           
protected  Vector m_updates
           
static String PROP_LUCENE_ANALYZER
          Which analyzer to use.
 
Fields inherited from interface com.ecyrd.jspwiki.WikiProvider
LATEST_VERSION
 
Constructor Summary
LuceneSearchProvider()
           
 
Method Summary
protected  void doFullLuceneReindex()
          Performs a full Lucene reindex, if necessary.
 Collection findPages(String query)
          Search for pages matching a search query
 String getProviderInfo()
          Return a valid HTML string for information.
 void initialize(WikiEngine engine, Properties props)
          Initializes the page provider.
 void pageRemoved(WikiPage page)
          Delete a page from the search index
 void reindexPage(WikiPage page)
          Adds a page-text pair to the lucene update queue.
protected  void updateLuceneIndex(WikiPage page, String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log

PROP_LUCENE_ANALYZER

public static final String PROP_LUCENE_ANALYZER
Which analyzer to use. Default is StandardAnalyzer.

See Also:
Constant Field Values

LUCENE_OPTIMIZE_COUNT

public static final int LUCENE_OPTIMIZE_COUNT
See Also:
Constant Field Values

m_updates

protected Vector m_updates
Constructor Detail

LuceneSearchProvider

public LuceneSearchProvider()
Method Detail

initialize

public void initialize(WikiEngine engine,
                       Properties props)
                throws NoRequiredPropertyException,
                       IOException
Description copied from interface: WikiProvider
Initializes the page provider.

Specified by:
initialize in interface WikiProvider
Throws:
NoRequiredPropertyException
IOException

doFullLuceneReindex

protected void doFullLuceneReindex()
                            throws IOException
Performs a full Lucene reindex, if necessary.

Throws:
IOException

updateLuceneIndex

protected void updateLuceneIndex(WikiPage page,
                                 String text)

pageRemoved

public void pageRemoved(WikiPage page)
Description copied from interface: SearchProvider
Delete a page from the search index

Specified by:
pageRemoved in interface SearchProvider
Parameters:
page - Page to remove from search index

reindexPage

public void reindexPage(WikiPage page)
Adds a page-text pair to the lucene update queue. Safe to call always

Specified by:
reindexPage in interface SearchProvider
Parameters:
page - The WikiPage to be indexed.

findPages

public Collection findPages(String query)
                     throws ProviderException
Description copied from interface: SearchProvider
Search for pages matching a search query

Specified by:
findPages in interface SearchProvider
Parameters:
query - query to search for
Returns:
collection of pages that match query
Throws:
ProviderException

getProviderInfo

public String getProviderInfo()
Description copied from interface: WikiProvider
Return a valid HTML string for information. May be anything.

Specified by:
getProviderInfo in interface WikiProvider