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 org.craftercms.search.service.QueryFactory<org.craftercms.search.service.Query> |
queryFactory |
protected List<String> |
referenceXPaths |
protected org.craftercms.search.service.SearchService |
searchService |
| Constructor and Description |
|---|
BinaryFileWithMetadataBatchIndexer() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doDeletes(String indexId,
String siteName,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
List<String> deletePaths,
IndexingStatus status) |
protected void |
doUpdates(String indexId,
String siteName,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
List<String> updatePaths,
IndexingStatus status) |
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(String indexId,
String siteName,
String metadataPath) |
protected String |
searchMetadataPathFromBinaryPath(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 |
setQueryFactory(org.craftercms.search.service.QueryFactory<org.craftercms.search.service.Query> queryFactory) |
void |
setReferenceXPaths(List<String> referenceXPaths) |
void |
setSearchService(org.craftercms.search.service.SearchService searchService) |
protected boolean |
shouldIncludeProperty(String name) |
protected void |
updateBinary(String indexId,
String siteName,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
String binaryPath,
IndexingStatus status) |
protected void |
updateBinaryWithMetadata(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,
IndexingStatus status) |
void |
updateIndex(String indexId,
String siteName,
org.craftercms.core.service.ContentStoreService contentStoreService,
org.craftercms.core.service.Context context,
List<String> paths,
boolean delete,
IndexingStatus status)
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
protected org.craftercms.search.service.SearchService searchService
protected org.craftercms.search.service.QueryFactory<org.craftercms.search.service.Query> queryFactory
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 setSearchService(org.craftercms.search.service.SearchService searchService)
public void setQueryFactory(org.craftercms.search.service.QueryFactory<org.craftercms.search.service.Query> queryFactory)
public void updateIndex(String indexId, String siteName, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context, List<String> paths, boolean delete, IndexingStatus status) throws BatchIndexingException
BatchIndexerupdateIndex in interface BatchIndexerindexId - 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 usedpaths - the paths in the content store of the files to indexdelete - if the given files should be deleted from the index, otherwise they're addedstatus - status object used to track index updates and deletesBatchIndexingExceptionprotected void doUpdates(String indexId, String siteName, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context, List<String> updatePaths, IndexingStatus status)
protected void doDeletes(String indexId, String siteName, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context, List<String> deletePaths, IndexingStatus status)
protected boolean isMetadata(String path)
protected boolean isBinary(String path)
protected boolean isChildBinary(String path)
protected List<String> searchBinaryPathsFromMetadataPath(String indexId, String siteName, String metadataPath)
protected String searchMetadataPathFromBinaryPath(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(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, IndexingStatus status)
protected void updateBinary(String indexId, String siteName, org.craftercms.core.service.ContentStoreService contentStoreService, org.craftercms.core.service.Context context, String binaryPath, IndexingStatus status)
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.