Package org.apache.wiki.search.kendra
Class KendraSearchProvider
java.lang.Object
org.apache.wiki.search.kendra.KendraSearchProvider
- All Implemented Interfaces:
WikiProvider,SearchProvider
Search provider that implements {link SearchProvider} using AWS Kendra for
indexing. Note that we are using a Custom DataSource which limits the
attributes that can be uploaded / searched for each page (as per
https://docs.aws.amazon.com/kendra/latest/dg/custom-attributes.html). This
could be overcome by using an S3 bucket where any custom attributes can be
added.
- Since:
- 2.11.0
-
Field Summary
Fields inherited from interface org.apache.wiki.api.providers.WikiProvider
LATEST_VERSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.amazonaws.services.kendra.AWSkendraSearch for pages matching a search query.com.amazonaws.services.kendra.AWSkendraReturn a valid HTML string for information.voidinitialize(Engine engine, Properties properties) Initializes the page provider.voidThis method initialize the AWS Kendra Index and Datasources to be used.voidpageRemoved(Page page) Delete a page from the search index.voidreindexPage(Page page) Adds a WikiPage for indexing queue.voidsetKendra(com.amazonaws.services.kendra.AWSkendra kendra)
-
Constructor Details
-
KendraSearchProvider
public KendraSearchProvider()
-
-
Method Details
-
initialize
public void initialize(Engine engine, Properties properties) throws NoRequiredPropertyException, IOException Initializes the page provider.- Specified by:
initializein interfaceWikiProvider- Parameters:
engine- Engine to own this providerproperties- A set of properties used to initialize this provider- Throws:
NoRequiredPropertyException- If the provider needs a property which is not found in the property setIOException- If there is an IO problem
-
getProviderInfo
Return a valid HTML string for information. May be anything.- Specified by:
getProviderInfoin interfaceWikiProvider- Returns:
- A string describing the provider.
-
pageRemoved
Delete a page from the search index.- Specified by:
pageRemovedin interfaceSearchProvider- Parameters:
page- Page to remove from search index.
-
reindexPage
Adds a WikiPage for indexing queue. This is called a queue, since this method is expected to return pretty quickly, and indexing to be done in a separate thread.- Specified by:
reindexPagein interfaceSearchProvider- Parameters:
page- The WikiPage to be indexed.
-
findPages
public Collection<SearchResult> findPages(String query, Context wikiContext) throws ProviderException, IOException Search for pages matching a search query.- Specified by:
findPagesin interfaceSearchProvider- Parameters:
query- query to search forwikiContext- the context within which to run the search- Returns:
- collection of pages that match query
- Throws:
ProviderException- if the search provider failed.IOException- if for some reason the query could not be executed.
-
initializeIndexAndDataSource
This method initialize the AWS Kendra Index and Datasources to be used. -
getKendra
-
setKendra
-
buildClient
-
getIndexName
-
getDataSourceName
-