Package org.codelibs.fess.job
Class IndexExportJob
java.lang.Object
org.codelibs.fess.job.IndexExportJob
Job for exporting indexed search documents to the filesystem.
Each document is exported as a single file with URL structure mapped to directory structure.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PathbuildFilePath(String exportPath, String url, IndexExportFormatter formatter) Builds a filesystem path from a document URL.protected IndexExportFormattercreateFormatter(String format) Creates a formatter for the given format name.execute()Executes the export job, writing each matching document as a file.protected voidexportDocument(Map<String, Object> source, String exportPath, Set<String> excludeFields, IndexExportFormatter formatter) Exports a single document as a file.Sets the export format.query(org.opensearch.index.query.QueryBuilder queryBuilder) Sets the query to filter which documents to export.
-
Constructor Details
-
IndexExportJob
public IndexExportJob()Creates a new IndexExportJob instance.
-
-
Method Details
-
query
Sets the query to filter which documents to export.- Parameters:
queryBuilder- the query to use for filtering documents- Returns:
- this instance for method chaining
-
format
Sets the export format.- Parameters:
format- the format name (e.g. "html", "json")- Returns:
- this instance for method chaining
-
createFormatter
Creates a formatter for the given format name.- Parameters:
format- the format name- Returns:
- the formatter instance
- Throws:
IllegalArgumentException- if the format is null, empty, or not supported
-
execute
Executes the export job, writing each matching document as a file.- Returns:
- a string containing the execution result or error messages
-
exportDocument
protected void exportDocument(Map<String, Object> source, String exportPath, Set<String> excludeFields, IndexExportFormatter formatter) Exports a single document as a file.- Parameters:
source- the document source mapexportPath- the base export directory pathexcludeFields- the set of field names to exclude from outputformatter- the formatter to use for output
-
buildFilePath
Builds a filesystem path from a document URL.- Parameters:
exportPath- the base export directory pathurl- the document URLformatter- the formatter to determine file extensions- Returns:
- the target file path
-