> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Offline

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[old doc.lw link]: https//doc.lucidworks.com/app-studio/4.2/3199

[localhost link]: http://localhost:3000/docs/5/app-studio/reference/search-platforms/offline

[mintlify link]: https://doc.lucidworks.com/docs/5/app-studio/reference/search-platforms/offline

At times, it is not always possible to have access to your search device. To facilitate this, Appkit offers the ability to record responses and save them to disk when you do have access. Then, you can use those responses to carry on working offline.

<LwTemplate />

## 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:

```
/offline-data
    /<platform.id>
        response_<encoded query url>.json
```

Here, `<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:

```
my-data
    platforms.solr
        response_1234567.json
```

If a default query (with no query or filter terms) is run, this response will be written 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’s `pom.xml` file:

```xml wrap  theme={"dark"}
<dependency>
    <groupId>twigkit</groupId>
    <artifactId>twigkit.offline.search</artifactId>
    <version>${project.parent.version}</version>
</dependency>
```

After this is done, the next step is to update the configuration file of the platform you had been working online with in order to tell it that you are now working offline. The best way to do this is to use the [configuration overlay](/docs/5/fusion/dev-portal/appkit/concepts/configuration/overlaying-configuration). For example, if you previously recorded a number of responses from a Solr device, you could create or update the configuration file, `solr.conf`, in `src/dev/resources/conf/platforms/solr/` to have these entries:

```yaml wrap  theme={"dark"}
name: twigkit.search.offline.OfflineSearch
path: file://data-files/platforms.solr
```

Here, `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).
