public abstract class BaseElasticSearchIndexBuilder extends Object implements ElasticSearchIndexBuilder
| Modifier and Type | Class and Description |
|---|---|
protected class |
BaseElasticSearchIndexBuilder.BulkContentIndexerTask
This is the task that searches for any docs in the search index that do not have content yet,
digests the content and loads it into the index.
|
static class |
BaseElasticSearchIndexBuilder.IndexAction |
protected static class |
BaseElasticSearchIndexBuilder.NoOpTask |
protected class |
BaseElasticSearchIndexBuilder.RebuildIndexTask |
| Modifier and Type | Field and Description |
|---|---|
protected static String |
ADD_RESOURCE_VALIDATION_KEY_CONTENT_PRODUCER |
protected static String |
ADD_RESOURCE_VALIDATION_KEY_ENTITY_ID |
protected static String |
ADD_RESOURCE_VALIDATION_KEY_INDEX_ACTION |
protected static String |
ADD_RESOURCE_VALIDATION_KEY_RESOURCE_NAME
Key in the "validation map" built up by
validateAddResourceEvent(Event) (specifically
validateResourceName(Event, Map). |
protected static SecurityAdvisor |
allowAllAdvisor |
protected Timer |
backgroundScheduler
indexing thread that performs loading the actual content into the index.
|
protected int |
bulkRequestSize
Number of actions to send in one elasticsearch bulk index call
defaults to 10.
|
protected org.elasticsearch.client.Client |
client
ES Client, with access to any indexes in the cluster.
|
protected int |
contentIndexBatchSize
Number of documents to index at a time for each run of the context indexing task (defaults to 500).
|
protected static String |
DEFAULT_FACET_NAME |
protected static String |
DEFAULT_SUGGESTION_MATCHING_FIELD_NAME |
protected String |
defaultIndexSettingsResource |
protected String |
defaultMappingResource |
protected int |
delay
number seconds of wait after startup before starting the BulkContentIndexerTask (defaults to 3 minutes)
|
protected static String |
DELETE_RESOURCE_KEY_DOCUMENT_ID |
protected static String |
DELETE_RESOURCE_KEY_ENTITY_REFERENCE |
protected ElasticSearchIndexBuilderEventRegistrar |
eventRegistrar |
protected EventTrackingService |
eventTrackingService |
protected String |
facetName |
protected int |
facetTermSize
N most frequent terms
|
protected SearchItemFilter |
filter |
protected String |
indexedDocumentType |
protected String |
indexName
the ES indexname
|
protected String |
indexSettings
Expects a JSON string of ElasticSearch index settings.
|
protected Map<String,String> |
indexSettingsMerged
Combination of
indexSettings, its fallback read from defaultIndexSettingsResource and
overrides read in from ServerConfigurationService. |
protected long |
lastLoad |
protected String |
mapping
by default the mapping in configured in the mapping.json file.
|
protected String |
mappingMerged
Combination of
mapping, its fallback read from defaultMappingResource, and any overrides
implemented in initializeElasticSearchMapping(String). |
protected int |
maxNumberOfSuggestions
max number of suggestions to return when looking for suggestions (this populates the autocomplete drop down in the UI)
|
protected String |
name
Logical, well-known name, possibly distinct from the physical ES
indexName |
protected int |
period
how often the BulkContentIndexerTask runs in seconds (defaults to 1 minute)
|
protected Set<EntityContentProducer> |
producers |
protected boolean |
rebuildIndexOnStartup
set to true to force an index rebuild at startup time, defaults to false.
|
protected String[] |
searchResultFieldNames |
protected SecurityService |
securityService |
protected ServerConfigurationService |
serverConfigurationService |
protected long |
startTime |
protected String |
suggestionMatchingFieldName |
protected String[] |
suggestionResultFieldNames |
protected boolean |
testMode
this turns off the threads and does indexing inline.
|
protected Set<String> |
triggerFunctions |
protected boolean |
useFacetting |
protected boolean |
useSuggestions |
DEFAULT_INDEX_BUILDER_NAME, DEFAULT_INDEX_NAME| Constructor and Description |
|---|
BaseElasticSearchIndexBuilder() |
| Modifier and Type | Method and Description |
|---|---|
protected org.elasticsearch.common.xcontent.XContentBuilder |
addContent(org.elasticsearch.common.xcontent.XContentBuilder contentSourceBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent) |
protected org.elasticsearch.common.xcontent.XContentBuilder |
addCustomProperties(org.elasticsearch.common.xcontent.XContentBuilder contentSourceBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent) |
protected abstract org.elasticsearch.common.xcontent.XContentBuilder |
addFields(org.elasticsearch.common.xcontent.XContentBuilder contentSourceBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent) |
protected org.elasticsearch.action.search.SearchRequestBuilder |
addFindContentQueueRequestParams(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder) |
void |
addResource(Notification notification,
Event event) |
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
addSearchCoreParams(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchTerms,
List<String> references,
List<String> siteIds) |
protected org.elasticsearch.action.search.SearchRequestBuilder |
addSearchFacetting(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder) |
protected org.elasticsearch.action.search.SearchRequestBuilder |
addSearchPagination(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder,
int start,
int end) |
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
addSearchQuery(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchTerms,
List<String> references,
List<String> siteIds) |
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
addSearchReferences(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
List<String> references) |
protected org.elasticsearch.action.search.SearchRequestBuilder |
addSearchResultFields(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder) |
protected abstract org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
addSearchSiteIds(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
List<String> siteIds) |
protected org.elasticsearch.action.search.SearchRequestBuilder |
addSearchSuggestionResultFields(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder) |
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
addSearchSuggestionsCoreParams(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchString,
String currentSite,
boolean allMySites) |
protected org.elasticsearch.action.search.SearchRequestBuilder |
addSearchSuggestionsPagination(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder) |
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
addSearchSuggestionsQuery(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchString,
String currentSite,
boolean allMySites) |
protected abstract org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
addSearchSuggestionsSites(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String currentSite,
boolean allMySites) |
protected abstract org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
addSearchSuggestionsTerms(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchString) |
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
addSearchTerms(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchTerms) |
protected void |
assureIndex()
creates a new index if one does not exist
|
protected abstract void |
beforeBackgroundSchedulerInitialization()
Called after all ES config has been processed but before the background scheduler has been set up
and before any index startup ops have been invoked (
initializeIndex(). |
protected abstract void |
beforeElasticSearchConfigInitialization()
Gives subclasses a chance to initialize configuration prior to reading/processing any
ES configs.
|
protected org.elasticsearch.common.xcontent.XContentBuilder |
buildIndexRequestContentSource(String resourceName,
EntityContentProducer ecp,
boolean includeContent) |
protected abstract void |
completeAddResourceEventValidations(Event event,
Map<String,Object> validationContext) |
protected abstract org.elasticsearch.action.delete.DeleteRequestBuilder |
completeDeleteRequestBuilder(org.elasticsearch.action.delete.DeleteRequestBuilder deleteRequestBuilder,
Map<String,Object> deleteParams) |
protected abstract org.elasticsearch.action.search.SearchRequestBuilder |
completeFindContentQueueRequestBuilder(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder) |
protected abstract org.elasticsearch.action.index.IndexRequestBuilder |
completeIndexRequestBuilder(org.elasticsearch.action.index.IndexRequestBuilder requestBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent) |
protected org.elasticsearch.common.xcontent.XContentBuilder |
completeIndexRequestContentSourceBuilder(org.elasticsearch.common.xcontent.XContentBuilder contentSourceBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent) |
protected abstract org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
completeSearchRequestBuilders(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchTerms,
List<String> references,
List<String> siteIds) |
protected abstract org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
completeSearchSuggestionsRequestBuilders(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchString,
String currentSite,
boolean allMySites) |
protected void |
createIndex()
creates a new index, does not check if the exist exists
|
protected void |
deleteDocument(NoContentException noContentException) |
protected void |
deleteDocument(org.elasticsearch.search.SearchHit searchHit) |
protected void |
deleteDocumentWithParams(Map<String,Object> deleteParams) |
protected org.elasticsearch.action.delete.DeleteResponse |
deleteDocumentWithRequest(org.elasticsearch.action.delete.DeleteRequestBuilder deleteRequestBuilder) |
void |
destroy() |
protected void |
disableAzgSecurityAdvisor()
Disable the security advisor.
|
protected void |
dispatchValidatedAddResource(Map<String,Object> validationContext) |
protected void |
enableAzgSecurityAdvisor()
Establish a security advisor to allow the "embedded" work to occur with no need for additional security permissions.
|
protected void |
executeBulkRequest(org.elasticsearch.action.bulk.BulkRequestBuilder bulkRequest) |
protected Map<String,Collection<String>> |
extractCustomProperties(String resourceName,
EntityContentProducer contentProducer)
Extract properties from the given
EntityContentProducer
The EntityContentProducer.getCustomProperties(String) method returns a map of different kind of elements. |
protected Map<String,Object> |
extractDeleteDocumentParams(Map<String,Object> validationContext) |
protected Map<String,Object> |
extractDeleteDocumentParams(NoContentException noContentException) |
protected Map<String,Object> |
extractDeleteDocumentParams(org.elasticsearch.search.SearchHit searchHit) |
protected org.elasticsearch.action.search.SearchResponse |
findContentQueue() |
protected org.elasticsearch.action.search.SearchResponse |
findContentQueueWithRequest(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder) |
List<SearchBuilderItem> |
getAllSearchItems() |
Set<String> |
getContentFunctions() |
List<EntityContentProducer> |
getContentProducers()
get all the producers registered, as a clone to avoid concurrent
modification exceptions
|
String |
getFacetName() |
String |
getFieldFromSearchHit(String field,
org.elasticsearch.search.SearchHit hit)
loads the field from the SearchHit.
|
SearchItemFilter |
getFilter() |
List<SearchBuilderItem> |
getGlobalMasterSearchItems() |
protected abstract org.slf4j.Logger |
getLog() |
String |
getName() |
int |
getNDocs() |
int |
getPendingDocuments() |
SearchStatus |
getSearchStatus() |
StringBuilder |
getStatus(StringBuilder into) |
Set<String> |
getTriggerFunctions() |
boolean |
getUseFacetting() |
protected void |
indexAdd(String resourceName,
EntityContentProducer ecp)
schedules content for indexing.
|
void |
initialize(ElasticSearchIndexBuilderEventRegistrar eventRegistrar,
org.elasticsearch.client.Client client) |
protected Timer |
initializeBackgroundScheduler() |
protected TimerTask |
initializeContentQueueProcessingTask() |
protected Map<String,String> |
initializeElasticSearchIndexSettings(String injectedConfig) |
protected String |
initializeElasticSearchMapping(String injectedConfig) |
protected void |
initializeIndex() |
boolean |
isBuildQueueEmpty() |
boolean |
isEnabled() |
protected boolean |
isSupportedIndexAction(BaseElasticSearchIndexBuilder.IndexAction action) |
protected Optional<EntityContentProducer> |
matchEntityContentProducer(Predicate<EntityContentProducer> matcher) |
protected TimerTask |
newBulkContentIndexerTask() |
protected org.elasticsearch.action.bulk.BulkRequestBuilder |
newContentQueueBulkUpdateRequestBuilder() |
EntityContentProducer |
newEntityContentProducer(Event event)
Find a
EntityContentProducer capable of handling the given Event, or null if no
such producer has been registered. |
EntityContentProducer |
newEntityContentProducer(String ref)
Find a
EntityContentProducer capable of handling the given entity reference, or null if no
such producer has been registered. |
protected org.elasticsearch.action.search.SearchRequestBuilder |
newFindContentQueueRequestBuilder() |
protected org.elasticsearch.action.index.IndexRequestBuilder |
newIndexRequestBuilder(String resourceName,
EntityContentProducer ecp,
boolean includeContent) |
protected org.elasticsearch.common.xcontent.XContentBuilder |
newIndexRequestContentSourceBuilder(String resourceName,
EntityContentProducer ecp,
boolean includeContent) |
protected TimerTask |
newRebuildIndexTask() |
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
newSearchRequestAndQueryBuilders(String searchTerms,
List<String> references,
List<String> siteIds) |
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
newSearchSuggestionsRequestAndQueryBuilders(String searchString,
String currentSite,
boolean allMySites) |
protected abstract org.elasticsearch.common.xcontent.XContentBuilder |
noContentForIndexRequest(org.elasticsearch.common.xcontent.XContentBuilder contentSourceBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent) |
protected void |
noContentProducerForContentQueueEntry(org.elasticsearch.search.SearchHit hit,
String reference) |
protected <L,R> org.elasticsearch.common.lang3.tuple.Pair<L,R> |
pairOf(L left,
R right) |
protected org.elasticsearch.action.delete.DeleteRequestBuilder |
prepareDeleteDocument(Map<String,Object> deleteParams) |
protected org.elasticsearch.action.search.SearchRequestBuilder |
prepareFindContentQueue() |
protected org.elasticsearch.action.index.IndexRequestBuilder |
prepareIndex(String resourceName,
EntityContentProducer ecp,
boolean includeContent) |
protected void |
prepareIndexAdd(String resourceName,
EntityContentProducer ecp,
boolean includeContent) |
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
prepareSearchRequest(String searchTerms,
List<String> references,
List<String> siteIds,
int start,
int end) |
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> |
prepareSearchSuggestionsRequest(String searchString,
String currentSite,
boolean allMySites) |
protected void |
processContentQueue()
Searches for any docs in the search index that have not been indexed yet,
digests the content and loads it into the index.
|
protected void |
processContentQueueEntry(org.elasticsearch.search.SearchHit hit,
org.elasticsearch.action.bulk.BulkRequestBuilder bulkRequest) |
void |
rebuildIndex()
Removes any existing index, creates a new index, and rebuilds the index from the entities own stored state
|
protected abstract void |
rebuildIndexImmediately() |
protected void |
recreateIndex()
removes any existing index and creates a new one
|
void |
refreshIndex()
refresh the index from the current stored state
|
void |
registerEntityContentProducer(EntityContentProducer ecp)
register an entity content producer to provide content to the search
engine
|
protected void |
requireConfiguration() |
protected double |
roundTwoDecimals(double d) |
org.elasticsearch.action.search.SearchResponse |
search(String searchTerms,
List<String> references,
List<String> siteIds,
int start,
int end) |
org.elasticsearch.action.search.SearchResponse |
search(String searchTerms,
List<String> references,
List<String> siteIds,
int start,
int end,
Map<String,String> additionalSearchInformation) |
String[] |
searchSuggestions(String searchString,
String currentSite,
boolean allMySites) |
void |
setBulkRequestSize(int bulkRequestSize) |
void |
setContentIndexBatchSize(int contentIndexBatchSize) |
void |
setDefaultIndexSettingsResource(String defaultIndexSettingsResource) |
void |
setDefaultMappingResource(String defaultMappingResource) |
void |
setDelay(int delay) |
void |
setEventTrackingService(EventTrackingService eventTrackingService) |
void |
setFacetName(String facetName) |
void |
setFacetTermSize(int facetTermSize) |
void |
setFilter(SearchItemFilter filter) |
void |
setIndexedDocumentType(String indexedDocumentType) |
void |
setIndexName(String indexName) |
void |
setIndexSettings(String indexSettings) |
void |
setMapping(String mapping) |
void |
setMaxNumberOfSuggestions(int maxNumberOfSuggestions) |
void |
setName(String name) |
void |
setPeriod(int period) |
void |
setRebuildIndexOnStartup(boolean rebuildIndexOnStartup) |
void |
setSearchResultFieldNames(String[] searchResultFieldNames) |
void |
setSecurityService(SecurityService securityService) |
void |
setServerConfigurationService(ServerConfigurationService serverConfigurationService) |
void |
setSuggestionMatchingFieldName(String suggestionMatchingFieldName) |
void |
setSuggestionResultFieldNames(String[] suggestionResultFieldNames) |
void |
setTestMode(boolean testMode) |
void |
setTriggerFunctions(Collection<String> triggerFunctions) |
void |
setUseFacetting(boolean useFacetting) |
void |
setUseSuggestions(boolean useSuggestions) |
protected Map<String,Object> |
validateAddResourceEvent(Event event) |
protected void |
validateContentProducer(Event event,
Map<String,Object> validationContext) |
protected void |
validateIndexable(Event event,
Map<String,Object> validationContext) |
protected void |
validateIndexAction(Event event,
Map<String,Object> validationContext) |
protected void |
validateResourceName(Event event,
Map<String,Object> validationContext) |
protected void |
validateServiceEnabled(Event event,
Map<String,Object> validationContext) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetEventResourceFilterprotected static final String DEFAULT_FACET_NAME
protected static final String DEFAULT_SUGGESTION_MATCHING_FIELD_NAME
protected static final String ADD_RESOURCE_VALIDATION_KEY_RESOURCE_NAME
validateAddResourceEvent(Event) (specifically
validateResourceName(Event, Map).protected static final String ADD_RESOURCE_VALIDATION_KEY_CONTENT_PRODUCER
protected static final String ADD_RESOURCE_VALIDATION_KEY_INDEX_ACTION
protected static final String ADD_RESOURCE_VALIDATION_KEY_ENTITY_ID
protected static final String DELETE_RESOURCE_KEY_DOCUMENT_ID
protected static final String DELETE_RESOURCE_KEY_ENTITY_REFERENCE
protected static final SecurityAdvisor allowAllAdvisor
protected SecurityService securityService
protected ServerConfigurationService serverConfigurationService
protected EventTrackingService eventTrackingService
protected org.elasticsearch.client.Client client
protected String indexName
protected String name
indexNameprotected boolean rebuildIndexOnStartup
protected boolean useSuggestions
protected int maxNumberOfSuggestions
protected String suggestionMatchingFieldName
protected String[] suggestionResultFieldNames
protected String[] searchResultFieldNames
protected SearchItemFilter filter
protected boolean useFacetting
protected String facetName
protected int facetTermSize
protected int contentIndexBatchSize
protected int bulkRequestSize
protected int delay
protected int period
protected long startTime
protected long lastLoad
protected boolean testMode
protected String defaultMappingResource
protected String mapping
protected String mappingMerged
mapping, its fallback read from defaultMappingResource, and any overrides
implemented in initializeElasticSearchMapping(String). (Currently there are no such overrides in that
method... just the fallback resource lookup. And historically the mapping config was stored exclusively in
mapping. This new mappingMerged field was added for symmetry with indexSettingsMerged).protected String defaultIndexSettingsResource
protected String indexSettings
protected Map<String,String> indexSettingsMerged
indexSettings, its fallback read from defaultIndexSettingsResource and
overrides read in from ServerConfigurationService. This is the operational set of index configs.
indexSettings is just preserved for reference.protected String indexedDocumentType
protected Timer backgroundScheduler
protected Set<EntityContentProducer> producers
protected ElasticSearchIndexBuilderEventRegistrar eventRegistrar
public boolean isEnabled()
public void destroy()
destroy in interface SearchIndexBuilderpublic void initialize(ElasticSearchIndexBuilderEventRegistrar eventRegistrar, org.elasticsearch.client.Client client)
initialize in interface ElasticSearchIndexBuilderprotected abstract void beforeElasticSearchConfigInitialization()
beforeBackgroundSchedulerInitialization()protected void requireConfiguration()
protected abstract void beforeBackgroundSchedulerInitialization()
initializeIndex(). I.e. this is a
subclass's last chance to set up any configs on which background jobs and/or index maintenance
in general might depend.protected String initializeElasticSearchMapping(String injectedConfig)
protected Map<String,String> initializeElasticSearchIndexSettings(String injectedConfig)
protected Timer initializeBackgroundScheduler()
protected TimerTask initializeContentQueueProcessingTask()
protected TimerTask newBulkContentIndexerTask()
protected TimerTask newRebuildIndexTask()
protected void processContentQueue()
protected void processContentQueueEntry(org.elasticsearch.search.SearchHit hit,
org.elasticsearch.action.bulk.BulkRequestBuilder bulkRequest)
throws NoContentException
NoContentExceptionprotected void executeBulkRequest(org.elasticsearch.action.bulk.BulkRequestBuilder bulkRequest)
protected void noContentProducerForContentQueueEntry(org.elasticsearch.search.SearchHit hit,
String reference)
throws NoContentException
NoContentExceptionprotected org.elasticsearch.action.bulk.BulkRequestBuilder newContentQueueBulkUpdateRequestBuilder()
protected org.elasticsearch.action.search.SearchResponse findContentQueue()
protected org.elasticsearch.action.search.SearchRequestBuilder prepareFindContentQueue()
protected org.elasticsearch.action.search.SearchRequestBuilder newFindContentQueueRequestBuilder()
protected org.elasticsearch.action.search.SearchRequestBuilder addFindContentQueueRequestParams(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder)
protected abstract org.elasticsearch.action.search.SearchRequestBuilder completeFindContentQueueRequestBuilder(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder)
protected org.elasticsearch.action.search.SearchResponse findContentQueueWithRequest(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder)
protected void deleteDocument(org.elasticsearch.search.SearchHit searchHit)
protected void deleteDocument(NoContentException noContentException)
protected org.elasticsearch.action.delete.DeleteRequestBuilder prepareDeleteDocument(Map<String,Object> deleteParams)
protected abstract org.elasticsearch.action.delete.DeleteRequestBuilder completeDeleteRequestBuilder(org.elasticsearch.action.delete.DeleteRequestBuilder deleteRequestBuilder,
Map<String,Object> deleteParams)
protected org.elasticsearch.action.delete.DeleteResponse deleteDocumentWithRequest(org.elasticsearch.action.delete.DeleteRequestBuilder deleteRequestBuilder)
protected Map<String,Object> extractDeleteDocumentParams(org.elasticsearch.search.SearchHit searchHit)
protected Map<String,Object> extractDeleteDocumentParams(NoContentException noContentException)
protected void initializeIndex()
protected void assureIndex()
protected void createIndex()
protected void recreateIndex()
public void rebuildIndex()
rebuildIndex in interface SearchIndexBuilderprotected abstract void rebuildIndexImmediately()
public void refreshIndex()
refreshIndex in interface SearchIndexBuilderprotected org.elasticsearch.action.index.IndexRequestBuilder prepareIndex(String resourceName, EntityContentProducer ecp, boolean includeContent) throws IOException, NoContentException
resourceName - ecp - IOExceptionNoContentExceptionprotected org.elasticsearch.action.index.IndexRequestBuilder newIndexRequestBuilder(String resourceName, EntityContentProducer ecp, boolean includeContent) throws IOException
IOExceptionprotected abstract org.elasticsearch.action.index.IndexRequestBuilder completeIndexRequestBuilder(org.elasticsearch.action.index.IndexRequestBuilder requestBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent)
throws IOException
IOExceptionprotected org.elasticsearch.common.xcontent.XContentBuilder buildIndexRequestContentSource(String resourceName, EntityContentProducer ecp, boolean includeContent) throws NoContentException, IOException
NoContentExceptionIOExceptionprotected org.elasticsearch.common.xcontent.XContentBuilder newIndexRequestContentSourceBuilder(String resourceName, EntityContentProducer ecp, boolean includeContent) throws IOException
IOExceptionprotected abstract org.elasticsearch.common.xcontent.XContentBuilder addFields(org.elasticsearch.common.xcontent.XContentBuilder contentSourceBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent)
throws IOException
IOExceptionprotected org.elasticsearch.common.xcontent.XContentBuilder addCustomProperties(org.elasticsearch.common.xcontent.XContentBuilder contentSourceBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent)
throws IOException
IOExceptionprotected org.elasticsearch.common.xcontent.XContentBuilder addContent(org.elasticsearch.common.xcontent.XContentBuilder contentSourceBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent)
throws NoContentException,
IOException
NoContentExceptionIOExceptionprotected abstract org.elasticsearch.common.xcontent.XContentBuilder noContentForIndexRequest(org.elasticsearch.common.xcontent.XContentBuilder contentSourceBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent)
throws NoContentException
NoContentExceptionprotected org.elasticsearch.common.xcontent.XContentBuilder completeIndexRequestContentSourceBuilder(org.elasticsearch.common.xcontent.XContentBuilder contentSourceBuilder,
String resourceName,
EntityContentProducer ecp,
boolean includeContent)
throws IOException
IOExceptionprotected void prepareIndexAdd(String resourceName, EntityContentProducer ecp, boolean includeContent) throws NoContentException
resourceName - ecp - NoContentExceptionprotected void indexAdd(String resourceName, EntityContentProducer ecp)
resourceName - ecp - public int getPendingDocuments()
getPendingDocuments in interface SearchIndexBuilderpublic boolean isBuildQueueEmpty()
isBuildQueueEmpty in interface SearchIndexBuilderpublic void addResource(Notification notification, Event event)
addResource in interface SearchIndexBuilderprotected Map<String,Object> validateAddResourceEvent(Event event) throws IllegalArgumentException, IllegalStateException
protected void validateServiceEnabled(Event event, Map<String,Object> validationContext) throws IllegalArgumentException, IllegalStateException
protected void validateResourceName(Event event, Map<String,Object> validationContext) throws IllegalArgumentException, IllegalStateException
protected void validateContentProducer(Event event, Map<String,Object> validationContext) throws IllegalArgumentException, IllegalStateException
protected void validateIndexable(Event event, Map<String,Object> validationContext) throws IllegalArgumentException, IllegalStateException
protected void validateIndexAction(Event event, Map<String,Object> validationContext) throws IllegalArgumentException, IllegalStateException, UnsupportedOperationException
protected boolean isSupportedIndexAction(BaseElasticSearchIndexBuilder.IndexAction action)
protected abstract void completeAddResourceEventValidations(Event event, Map<String,Object> validationContext) throws IllegalArgumentException, IllegalStateException
protected void dispatchValidatedAddResource(Map<String,Object> validationContext)
protected Map<String,Object> extractDeleteDocumentParams(Map<String,Object> validationContext)
protected Map<String,Collection<String>> extractCustomProperties(String resourceName, EntityContentProducer contentProducer)
EntityContentProducer
The EntityContentProducer.getCustomProperties(String) method returns a map of different kind of elements.
To avoid casting and calls to instanceof, extractCustomProperties does all the work and returns a formated
map containing only Collection.
resourceName - affected resourcecontentProducer - producer providing properties for the given resourceCollectionpublic org.elasticsearch.action.search.SearchResponse search(String searchTerms, List<String> references, List<String> siteIds, int start, int end)
search in interface ElasticSearchIndexBuilderpublic org.elasticsearch.action.search.SearchResponse search(String searchTerms, List<String> references, List<String> siteIds, int start, int end, Map<String,String> additionalSearchInformation)
search in interface ElasticSearchIndexBuilderprotected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> prepareSearchRequest(String searchTerms, List<String> references, List<String> siteIds, int start, int end)
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> newSearchRequestAndQueryBuilders(String searchTerms, List<String> references, List<String> siteIds)
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> addSearchCoreParams(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchTerms,
List<String> references,
List<String> siteIds)
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> addSearchQuery(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchTerms,
List<String> references,
List<String> siteIds)
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> addSearchTerms(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchTerms)
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> addSearchReferences(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
List<String> references)
protected abstract org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> addSearchSiteIds(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
List<String> siteIds)
protected org.elasticsearch.action.search.SearchRequestBuilder addSearchResultFields(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder)
protected org.elasticsearch.action.search.SearchRequestBuilder addSearchPagination(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder,
int start,
int end)
protected org.elasticsearch.action.search.SearchRequestBuilder addSearchFacetting(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder)
protected abstract org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> completeSearchRequestBuilders(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchTerms,
List<String> references,
List<String> siteIds)
public String[] searchSuggestions(String searchString, String currentSite, boolean allMySites)
searchSuggestions in interface ElasticSearchIndexBuilderprotected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> prepareSearchSuggestionsRequest(String searchString, String currentSite, boolean allMySites)
protected abstract org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> completeSearchSuggestionsRequestBuilders(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchString,
String currentSite,
boolean allMySites)
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> newSearchSuggestionsRequestAndQueryBuilders(String searchString, String currentSite, boolean allMySites)
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> addSearchSuggestionsCoreParams(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchString,
String currentSite,
boolean allMySites)
protected org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> addSearchSuggestionsQuery(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchString,
String currentSite,
boolean allMySites)
protected abstract org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> addSearchSuggestionsTerms(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String searchString)
protected abstract org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> addSearchSuggestionsSites(org.elasticsearch.common.lang3.tuple.Pair<org.elasticsearch.action.search.SearchRequestBuilder,org.elasticsearch.index.query.QueryBuilder> builders,
String currentSite,
boolean allMySites)
protected org.elasticsearch.action.search.SearchRequestBuilder addSearchSuggestionResultFields(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder)
protected org.elasticsearch.action.search.SearchRequestBuilder addSearchSuggestionsPagination(org.elasticsearch.action.search.SearchRequestBuilder searchRequestBuilder)
public StringBuilder getStatus(StringBuilder into)
getStatus in interface ElasticSearchIndexBuilderprotected double roundTwoDecimals(double d)
public int getNDocs()
getNDocs in interface ElasticSearchIndexBuilderpublic SearchStatus getSearchStatus()
getSearchStatus in interface ElasticSearchIndexBuilderpublic EntityContentProducer newEntityContentProducer(String ref)
EntityContentProducer capable of handling the given entity reference, or null if no
such producer has been registered.newEntityContentProducer in interface SearchIndexBuilderref - the entity referencepublic EntityContentProducer newEntityContentProducer(Event event)
EntityContentProducer capable of handling the given Event, or null if no
such producer has been registered.newEntityContentProducer in interface SearchIndexBuilderevent - protected Optional<EntityContentProducer> matchEntityContentProducer(Predicate<EntityContentProducer> matcher)
public List<EntityContentProducer> getContentProducers()
getContentProducers in interface SearchIndexBuilderpublic void registerEntityContentProducer(EntityContentProducer ecp)
registerEntityContentProducer in interface SearchIndexBuilderpublic Set<String> getContentFunctions()
getContentFunctions in interface ElasticSearchIndexBuilderprotected void enableAzgSecurityAdvisor()
protected void disableAzgSecurityAdvisor()
public String getFieldFromSearchHit(String field, org.elasticsearch.search.SearchHit hit)
getFieldFromSearchHit in interface ElasticSearchIndexBuilderfield - hit - protected <L,R> org.elasticsearch.common.lang3.tuple.Pair<L,R> pairOf(L left,
R right)
public List<SearchBuilderItem> getAllSearchItems()
getAllSearchItems in interface SearchIndexBuilderpublic void setIndexedDocumentType(String indexedDocumentType)
public void setTestMode(boolean testMode)
public void setRebuildIndexOnStartup(boolean rebuildIndexOnStartup)
public boolean getUseFacetting()
getUseFacetting in interface ElasticSearchIndexBuilderpublic void setUseFacetting(boolean useFacetting)
public void setFacetName(String facetName)
public void setMaxNumberOfSuggestions(int maxNumberOfSuggestions)
public void setUseSuggestions(boolean useSuggestions)
public void setSuggestionResultFieldNames(String[] suggestionResultFieldNames)
public void setSuggestionMatchingFieldName(String suggestionMatchingFieldName)
public void setSearchResultFieldNames(String[] searchResultFieldNames)
public void setFilter(SearchItemFilter filter)
public SearchItemFilter getFilter()
getFilter in interface ElasticSearchIndexBuilderpublic String getFacetName()
getFacetName in interface ElasticSearchIndexBuilderpublic void setFacetTermSize(int facetTermSize)
public String getName()
getName in interface SearchIndexBuilderpublic void setName(String name)
public void setIndexName(String indexName)
public void setDefaultIndexSettingsResource(String defaultIndexSettingsResource)
public void setMapping(String mapping)
public void setIndexSettings(String indexSettings)
public void setDefaultMappingResource(String defaultMappingResource)
public void setDelay(int delay)
public void setPeriod(int period)
public void setContentIndexBatchSize(int contentIndexBatchSize)
public void setBulkRequestSize(int bulkRequestSize)
public void setSecurityService(SecurityService securityService)
public void setServerConfigurationService(ServerConfigurationService serverConfigurationService)
public void setEventTrackingService(EventTrackingService eventTrackingService)
public void setTriggerFunctions(Collection<String> triggerFunctions)
public Set<String> getTriggerFunctions()
getTriggerFunctions in interface ElasticSearchIndexBuilderpublic List<SearchBuilderItem> getGlobalMasterSearchItems()
getGlobalMasterSearchItems in interface SearchIndexBuilderprotected abstract org.slf4j.Logger getLog()
Copyright © 2003–2018 Sakai Project. All rights reserved.