typesense / docusaurus-theme-search-typesense

A fork of the awesome @docusaurus/theme-search-algolia library customized to work with Typesense
https://typesense.org/docs/guide/docsearch.html
MIT License
67 stars 15 forks source link

useSearchQuery can't be resolved #1

Closed dannysofftie closed 3 years ago

dannysofftie commented 3 years ago

Description

Module not found: Error: Can't resolve '@theme/hooks/useSearchQuery' in './node_modules/docusaurus-theme-search-typesense/src/theme/SearchPage'

Steps to reproduce

  1. Install this package into a docusurus project yarn add docusaurus-theme-search-typesense
  2. Add below config to docusaurus.config.js
    {
    themes: ['docusaurus-theme-search-typesense'],
    themeConfig: {
    typesense: {
      typesenseCollectionName: 'docs',
      typesenseServerConfig: {
        nodes: [
          {
            host: '127.0.0.1',
            port: 9090,
            protocol: 'http',
          },
        ],
        apiKey: '< key >',
      },
      typesenseSearchParameters: {},
      // Optional
      contextualSearch: true,
    },
    },
    }

Expected Behavior

Show search bar in generated docs website

Actual Behavior

image

Metadata

Typsense Version: 0.21.0

OS: Ubuntu 20.04.3

dannysofftie commented 3 years ago

The setup isn't clear, solved above by configuring docusaurus correctly

jasonbosco commented 3 years ago

@dannysofftie Could you expand on which part of the setup instructions were unclear? Would love to address any confusion in the docs.

dtlhlbs commented 2 years ago

@dannysofftie have the same issue, would like to know how to go about "configuring docusaurus correctly"

jasonbosco commented 2 years ago

@dtlhlbs Could you try upgrading to v2.0.0-beta.16 of Docusaurus and also v0.4.0-0 of docusaurus-theme-search-typesense?

dtlhlbs commented 2 years ago

@jasonbosco Turns out it was the re-compiling under webpack that didn't work. All I need to do was stop the dev server and yarn start again and it was fine. For others, after installing this package I made these changes to docusaurus.config.js