Recording responses
By booting your application with the system variable-Dtwigkit.offline.recording=true
, every search response served by the backend device will be serialized to a JSON file written to disk. By default, the location of the saved response JSON file relative to the application root will be as follows:
<platform.id>
is either the configuration name of the platform (for example, platforms.fusion
) or the platform ID, and <encoded query url>
is an encoded form of the query URL that was used to generate the response. The default offline root folder, offline-data
, can be overridden by setting the system variable -Dtwigkit.offline.recording.path
to a relative or absolute file path.
For example, suppose you submit a query to the platforms.solr
platform instance, with -Dtwigkit.offline.recording.path=my-data
. Then the system will save any response serialized as a JSON file to:
response.json
and saved in the appropriate platform folder.
Working offline
The Offline Search platform is a search interface that serves static content by matching search queries with JSON data files read from disk. Each JSON data file contains a serialized Appkit response object, independent of the particular search engine that produced the original search results. See the section above for information on how to capture and store search response data. To work offline with recorded responses, the first step is to add this dependency to your project’spom.xml
file:
solr.conf
, in src/dev/resources/conf/platforms/solr/
to have these entries:
path
defines the location of the offline response JSON files. This can either be a relative path (for example, ./data-files), resolved relative to the directory from which the web server is booted, or an absolute path (for example, /var/data-files).