public class BinaryFileWithMetadataBatchIndexer extends Object implements BatchIndexer
BatchIndexer that tries to match binary files with metadata files. Right now, a metadata file
can reference several binary files. Also, this indexer supports the concept of "child" binaries, where the parent is the metadata
file and the binary file only exists in the index as long as the metadata file exists and it references the binary.| Modifier and Type | Class and Description |
|---|---|
static class |
BinaryFileWithMetadataBatchIndexer.EmptyContent |
| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
binaryPathPatterns |
protected List<String> |
childBinaryPathPatterns |
static String |
DEFAULT_LOCAL_ID_FIELD_NAME |
static String |
DEFAULT_METADATA_PATH_FIELD_NAME |
protected List<String> |
excludeMetadataProperties
Deprecated.
|
protected List<String> |
excludePropertyPatterns |
protected List<String> |
includePropertyPatterns |
protected org.craftercms.core.processors.ItemProcessor |
itemProcessor |
protected String |
localIdFieldName |
protected String |
metadataPathFieldName |
protected List<String> |
metadataPathPatterns |
protected List<String> |
referenceXPaths |
| Constructor and Description |
|---|
BinaryFileWithMetadataBatchIndexer() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doDeletes(String indexId,
String siteName,
org.craftercms.search.service.SearchService searchService,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
List<String> deletePaths,
UpdateStatus updateStatus) |
protected void |
doUpdates(String indexId,
String siteName,
org.craftercms.search.service.SearchService searchService,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
List<String> updatePaths,
UpdateStatus updateStatus) |
protected org.springframework.util.MultiValueMap<String,String> |
extractMetadata(String path,
org.dom4j.Document document) |
protected void |
extractMetadataFromChildren(org.dom4j.Element element,
String key,
org.springframework.util.MultiValueMap<String,String> metadata) |
protected List<String> |
getBinaryFilePaths(org.dom4j.Document document) |
protected boolean |
isBinary(String path) |
protected boolean |
isChildBinary(String path) |
protected boolean |
isMetadata(String path) |
protected org.dom4j.Document |
loadMetadata(org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
String siteName,
String metadataPath) |
protected List<String> |
searchBinaryPathsFromMetadataPath(org.craftercms.search.service.SearchService searchService,
String indexId,
String siteName,
String metadataPath) |
protected String |
searchMetadataPathFromBinaryPath(org.craftercms.search.service.SearchService searchService,
String indexId,
String siteName,
String binaryPath) |
void |
setBinaryPathPatterns(List<String> binaryPathPatterns) |
void |
setChildBinaryPathPatterns(List<String> childBinaryPathPatterns) |
void |
setExcludeMetadataProperties(List<String> excludeMetadataProperties)
Deprecated.
|
void |
setExcludePropertyPatterns(List<String> excludePropertyPatterns) |
void |
setIncludePropertyPatterns(List<String> includePropertyPatterns) |
void |
setItemProcessor(org.craftercms.core.processors.ItemProcessor itemProcessor) |
void |
setItemProcessors(List<org.craftercms.core.processors.ItemProcessor> itemProcessors) |
void |
setLocalIdFieldName(String localIdFieldName) |
void |
setMetadataPathFieldName(String metadataPathFieldName) |
void |
setMetadataPathPatterns(List<String> metadataPathPatterns) |
void |
setReferenceXPaths(List<String> referenceXPaths) |
protected boolean |
shouldIncludeProperty(String name) |
protected void |
updateBinary(org.craftercms.search.service.SearchService searchService,
String indexId,
String siteName,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
String binaryPath,
UpdateStatus updateStatus) |
protected void |
updateBinaryWithMetadata(org.craftercms.search.service.SearchService searchService,
String indexId,
String siteName,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
String binaryPath,
org.springframework.util.MultiValueMap<String,String> metadata,
UpdateStatus updateStatus) |
void |
updateIndex(org.craftercms.search.service.SearchService searchService,
String indexId,
String siteName,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
UpdateSet updateSet,
UpdateStatus updateStatus)
Updates the specified search index with the given batch of files.
|
public static final String DEFAULT_METADATA_PATH_FIELD_NAME
public static final String DEFAULT_LOCAL_ID_FIELD_NAME
protected org.craftercms.core.processors.ItemProcessor itemProcessor
@Deprecated protected List<String> excludeMetadataProperties
protected String metadataPathFieldName
protected String localIdFieldName
public void setItemProcessor(org.craftercms.core.processors.ItemProcessor itemProcessor)
public void setItemProcessors(List<org.craftercms.core.processors.ItemProcessor> itemProcessors)
public void setChildBinaryPathPatterns(List<String> childBinaryPathPatterns)
public void setIncludePropertyPatterns(List<String> includePropertyPatterns)
public void setExcludePropertyPatterns(List<String> excludePropertyPatterns)
@Deprecated public void setExcludeMetadataProperties(List<String> excludeMetadataProperties)
public void setMetadataPathFieldName(String metadataPathFieldName)
public void setLocalIdFieldName(String localIdFieldName)
public void updateIndex(org.craftercms.search.service.SearchService searchService,
String indexId,
String siteName,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
UpdateSet updateSet,
UpdateStatus updateStatus)
throws BatchIndexingException
BatchIndexerupdateIndex in interface BatchIndexersearchService - the search service to useindexId - the ID of the index, or null to use a default indexsiteName - the name of the site the files belong tocontentStoreService - the content store service used to retrieve the files and content to indexcontext - the context of the file store being usedupdateSet - the set of files to update/deleteupdateStatus - status object used to track index updates and deletesBatchIndexingExceptionprotected void doUpdates(String indexId, String siteName, org.craftercms.search.service.SearchService searchService, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context, List<String> updatePaths, UpdateStatus updateStatus)
protected void doDeletes(String indexId, String siteName, org.craftercms.search.service.SearchService searchService, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context, List<String> deletePaths, UpdateStatus updateStatus)
protected boolean isMetadata(String path)
protected boolean isBinary(String path)
protected boolean isChildBinary(String path)
protected List<String> searchBinaryPathsFromMetadataPath(org.craftercms.search.service.SearchService searchService, String indexId, String siteName, String metadataPath)
protected String searchMetadataPathFromBinaryPath(org.craftercms.search.service.SearchService searchService, String indexId, String siteName, String binaryPath)
protected org.dom4j.Document loadMetadata(org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
String siteName,
String metadataPath)
protected void updateBinaryWithMetadata(org.craftercms.search.service.SearchService searchService,
String indexId,
String siteName,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
String binaryPath,
org.springframework.util.MultiValueMap<String,String> metadata,
UpdateStatus updateStatus)
protected void updateBinary(org.craftercms.search.service.SearchService searchService,
String indexId,
String siteName,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
String binaryPath,
UpdateStatus updateStatus)
protected org.springframework.util.MultiValueMap<String,String> extractMetadata(String path, org.dom4j.Document document)
protected void extractMetadataFromChildren(org.dom4j.Element element,
String key,
org.springframework.util.MultiValueMap<String,String> metadata)
protected boolean shouldIncludeProperty(String name)
Copyright © 2018 CrafterCMS. All rights reserved.