public class SearchManager extends BasicPageFilter implements InternalModule, WikiEventListener
Modifier and Type | Class and Description |
---|---|
class |
SearchManager.JSONSearch
Provides a JSON RPC API to the JSPWiki Search Engine.
|
Modifier and Type | Field and Description |
---|---|
static String |
JSON_SEARCH
The name of the JSON object that manages search.
|
static String |
PROP_SEARCHPROVIDER
Property name for setting the search provider.
|
m_engine
Constructor and Description |
---|
SearchManager(WikiEngine engine,
Properties properties)
Creates a new SearchManager.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(WikiEvent event)
If the page has been deleted, removes it from the index.
|
Collection<SearchResult> |
findPages(String query,
WikiContext wikiContext)
Sends a search to the current search provider.
|
SearchProvider |
getSearchEngine()
Returns the SearchProvider used.
|
void |
initialize(WikiEngine engine,
Properties properties)
This particular method starts off indexing and all sorts of various activities,
so you need to run this last, after things are done.
|
void |
pageRemoved(WikiPage page)
Removes the page from the search cache (if any).
|
void |
postSave(WikiContext wikiContext,
String content)
Reindexes the page.
|
void |
reindexPage(WikiPage page)
Forces the reindex of the given page.
|
destroy, postTranslate, preSave, preTranslate
public static final String PROP_SEARCHPROVIDER
public static final String JSON_SEARCH
public SearchManager(WikiEngine engine, Properties properties) throws FilterException
engine
- The WikiEngine that owns this SearchManager.properties
- The list of Properties.FilterException
- If it cannot be instantiated.public void initialize(WikiEngine engine, Properties properties) throws FilterException
initialize
in interface PageFilter
initialize
in class BasicPageFilter
engine
- the wiki engineproperties
- the properties used to initialize the wiki engineFilterException
- if the search provider failed to initializepublic SearchProvider getSearchEngine()
public Collection<SearchResult> findPages(String query, WikiContext wikiContext) throws ProviderException, IOException
query
- The query. Null is safe, and is interpreted as an empty query.wikiContext
- the context within which to run the searchProviderException
- If the provider fails and a search cannot be completed.IOException
- If something else goes wrong.public void pageRemoved(WikiPage page)
page
- The page to removepublic void postSave(WikiContext wikiContext, String content)
postSave
in interface PageFilter
postSave
in class BasicPageFilter
wikiContext
- The WikiContextcontent
- The content which was just stored.public void reindexPage(WikiPage page)
page
- The page.public void actionPerformed(WikiEvent event)
actionPerformed
in interface WikiEventListener
event
- a WikiEvent objectCopyright © 2001-2019 The Apache Software Foundation. All rights reserved.