Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search function #3

Closed
chendelin1982 opened this issue Jan 25, 2022 · 11 comments
Closed

Search function #3

chendelin1982 opened this issue Jan 25, 2022 · 11 comments
Assignees

Comments

@chendelin1982
Copy link
Contributor

chendelin1982 commented Jan 25, 2022

Need enable Search function

@qiaofeng1227
Copy link
Contributor

image

@qiaofeng1227
Copy link
Contributor

add algolia

@qiaofeng1227
Copy link
Contributor

每月10000条,合计每日300次搜索免费
image

@qiaofeng1227
Copy link
Contributor

qiaofeng1227 commented Jan 28, 2022

引入DocSearch有两种方式:

  1. 整体引入
    algolia: {
      // The application ID provided by Algolia
      appId: '7OW3EQLSSO',

      // Public API key: it is safe to commit it
      apiKey: 'cdde477c72a2c884c51e7c28219a839a',

      indexName: 'websoft9',

      // Optional: see doc section below
      //contextualSearch: true,

      // Optional: Specify domains where the navigation should occur through window.location instead on history.push. Useful when our Algolia config crawls multiple documentation sites and we want to navigate with window.location.href to them.
      externalUrlRegex: 'http://8.142.3.195:3000',

      // Optional: Algolia search parameters
      //searchParameters: {},

      //... other Algolia params
    }
  1. 单独页面引入

image

@qiaofeng1227
Copy link
Contributor

@qiaofeng1227
Copy link
Contributor

plugins: [require.resolve('docusaurus-lunr-search')]
image

plugins: [require.resolve("@cmfcmf/docusaurus-search-local")]
image

@qiaofeng1227
Copy link
Contributor

qiaofeng1227 commented Mar 7, 2022

@qiaofeng1227
Copy link
Contributor

complete

@qiaofeng1227
Copy link
Contributor

qiaofeng1227 commented Jun 22, 2022

server and scraper

@zhaojing1987
Copy link
Contributor

zhaojing1987 commented Jun 23, 2022

Add a Search Bar to the Documentation Site:
1、use the docusaurus-theme-search-typesense plugin to add a search bar to theDocusaurus site:
npm install docusaurus-theme-search-typesense@next --save
or
yarn add docusaurus-theme-search-typesense@next
2、Add the following to your docusaurus.config.js file:

{
  themes: ['docusaurus-theme-search-typesense'],
  themeConfig: {
    typesense: {
      typesenseCollectionName: 'websoft9', // Replace with your own doc site's name. Should match the collection name in the scraper settings.
      
      typesenseServerConfig: {
        nodes: [
          {
            host: 'xxx-1.a1.typesense.net',
            port: 443,
            protocol: 'https',
          },
        ],
        apiKey: 'xyz',
      },

      // Optional: Typesense search parameters: https://typesense.org/docs/0.21.0/api/documents.md#search-parameters
      typesenseSearchParameters: {},

      // Optional
      contextualSearch: true,
    },
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants