support search context by paths.

This commit is contained in:
Hossein Mehrabi
2022-10-26 14:53:44 +03:30
parent 0f7450778e
commit dd807252bf
2 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -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()