Class IndexExportJob

java.lang.Object
org.codelibs.fess.job.IndexExportJob

public class IndexExportJob extends Object
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 Details

    • IndexExportJob

      public IndexExportJob()
      Creates a new IndexExportJob instance.
  • Method Details

    • query

      public IndexExportJob query(org.opensearch.index.query.QueryBuilder queryBuilder)
      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

      public IndexExportJob format(String format)
      Sets the export format.
      Parameters:
      format - the format name (e.g. "html", "json")
      Returns:
      this instance for method chaining
    • createFormatter

      protected IndexExportFormatter createFormatter(String format)
      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

      public String 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 map
      exportPath - the base export directory path
      excludeFields - the set of field names to exclude from output
      formatter - the formatter to use for output
    • buildFilePath

      protected Path buildFilePath(String exportPath, String url, IndexExportFormatter formatter)
      Builds a filesystem path from a document URL.
      Parameters:
      exportPath - the base export directory path
      url - the document URL
      formatter - the formatter to determine file extensions
      Returns:
      the target file path