Skip to content

Cannot get Typesense to work with VuePress 2.x #255

@ricoapon

Description

@ricoapon

Description

There is documentation on how to use your own Typesense server in Vuepress. This seems to be created for VuePress 1.x. I cannot get it to work on VuePress 2.x.

Broken component

The component TypesenseSearchBox.vue does not work out of the box anymore for multiple reasons.

  1. Components are not automatically registered anymore. You need to install the plugin @vuepress/plugin-register-components and configure this.
  2. It requires the docsearch dependency, but this is not included. You need to install the plugin @vuepress/plugin-docsearch for this. Couldn't get this to work, so I manually downloaded the docsearch javascript files and added this.
  3. Options are not configurable anymore in themeConfig. This works differently. I don't know what would be the equivalent.

What I tried

I tried to configure the plugin @vuepress/plugin-docsearch. I think this is the way forward, but I could not make it work. The reason is that I cannot get a proper client to work. Maybe somebody with expertise can help me figure this out.

What I did:

  1. Create a new VuePress 2 project.
  2. Install the plugin @vuepress/plugin-docsearch.
  3. Created the file src/.vuepress/client.ts and gave it the following content:
import {defineDocSearchConfig} from "@vuepress/plugin-docsearch/client";
defineDocSearchConfig({
    // @ts-ignore
    transformSearchClient: (searchClient) => {
        return ??? // What to fill in here?
    }
})

I think if I could make this transformSearchClient work, then it would be perfect. However, I don't know what to use. I tried to use typesense-docsearch, but this requires React, and that doesn't work. I hope that we can figure this out, and if we do, that we document it on the website as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions