mirror of
https://github.com/wavetermdev/docusaurus-og.git
synced 2026-08-05 13:46:35 -07:00
support search context by paths.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@acid-info/logos-docusaurus-theme",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "A Docusaurus theme for Logos documentation websites",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/theme.d.ts",
|
||||
@@ -14,6 +14,7 @@
|
||||
"cleanup": "yarn cleanup",
|
||||
"watch": "yarn gulp watch",
|
||||
"build": "yarn gulp build",
|
||||
"build:watch": "yarn gulp watch --command 'yarn build'",
|
||||
"build:client": "yarn gulp build-client && yarn gulp client-post-build",
|
||||
"build:server": "yarn gulp build-server",
|
||||
"prepublishOnly": "yarn build"
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useProxiedGeneratedData } from './useProxiedGeneratedData'
|
||||
import { useVersionUrl } from './useVersionUrl'
|
||||
|
||||
export const useSearch = () => {
|
||||
const win = window as any
|
||||
|
||||
const data = useProxiedGeneratedData()
|
||||
const versionUrl = useVersionUrl()
|
||||
|
||||
const [loaded, setLoaded] = useState(false)
|
||||
@@ -13,6 +15,7 @@ export const useSearch = () => {
|
||||
search.current = await win.createSearchInstance({
|
||||
resultsLimit: 50,
|
||||
preferredVersionPath: versionUrl,
|
||||
searchContextByPaths: data.searchContextByPaths,
|
||||
})
|
||||
|
||||
await search.current.init()
|
||||
|
||||
Reference in New Issue
Block a user