Exporting results to Excel
The Excel export service is constrained by the fact that the Excel document needs to be created in memory and therefore recommended for relatively small result sets. For larger exports, we recommend using the CSV export service. Use themedia:excel
tag to generate a link to export results to Excel.
Exporting results to CSV
The CSV export service is used for writing search results to a file in comma-delimited format (or other delimited formats). This service requires the platform configuration to use and any combination of query parameters you would normally pass to an Appkit search page. The CSV export service is highly scalable and will retrieve entire indexes (if deep offset is supported by the search engine) and spool to files in a scalable manner. You can generate an export link using themedia:csv
tag:
Offline export
When exporting a large number of documents, it can be preferable to run the export process in the background, to avoid browser time-out. We cater for this possibility by running offline exports in a separate thread and storing the CSV output in a file in the local file system of the application server (which might be a shared mount when running multiple nodes). To control how export files are generated and stored, you have these configuration options inservices/media/export/offline
in the configuration hierarchy:
-
compress
: Whether or not to compress the final CSV file into a ZIP archive. -
temp-folder
: Folder in which to store exported files on the application server, whilst streaming results from the platform (and before they are moved to their final destination). This can either be an absolute file path or relative to the application server root. If omitted, OS-specific temporary file folders are used. -
redirect-path
: Path to redirect user after export has been initiated. -
folder
: Folder in which to store exported files on the application server. This can either be an absolute file path or relative to the application server root. The path can be written as an expression, with variables that are resolved for the user that is performing the export:{{id}}
: The ID of the user.{{name}}
: The user name of the user (if different from the ID).{{domain}}
: The domain of the user. For example,/var/data/export/{{domain}}/{{id}}/
.
twigkit.media.export.ExportCompleted
event. You can write your own event handler like so:
AppkitModule
:
Configuring export links within your search controls
Often it is useful to provide export options alongside your search results. You can achieve this using the above export tags along with some widget popover code:
link-text="Export"
to change the title of the link, and add further <li>
elements with links in as required.