mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
Update website to use new Algolia search API
This commit is contained in:
parent
00e7bf5ffd
commit
a437ca6737
|
@ -22,7 +22,8 @@
|
||||||
"list": "89ad33e698"
|
"list": "89ad33e698"
|
||||||
},
|
},
|
||||||
"docSearch": {
|
"docSearch": {
|
||||||
"apiKey": "371e26ed49d29a27bd36273dfdaf89af",
|
"appId": "Y1LB128RON",
|
||||||
|
"apiKey": "bb601a1daab73e2dc66faf2b79564807",
|
||||||
"indexName": "spacy"
|
"indexName": "spacy"
|
||||||
},
|
},
|
||||||
"binderUrl": "explosion/spacy-io-binder",
|
"binderUrl": "explosion/spacy-io-binder",
|
||||||
|
|
|
@ -6,13 +6,14 @@ import Icon from './icon'
|
||||||
import classes from '../styles/search.module.sass'
|
import classes from '../styles/search.module.sass'
|
||||||
|
|
||||||
export default function Search({ id = 'docsearch', placeholder = 'Search docs', settings = {} }) {
|
export default function Search({ id = 'docsearch', placeholder = 'Search docs', settings = {} }) {
|
||||||
const { apiKey, indexName } = settings
|
const { apiKey, indexName, appId } = settings
|
||||||
if (!apiKey && !indexName) return null
|
if (!apiKey && !indexName) return null
|
||||||
const [initialized, setInitialized] = useState(false)
|
const [initialized, setInitialized] = useState(false)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
setInitialized(true)
|
setInitialized(true)
|
||||||
window.docsearch({
|
window.docsearch({
|
||||||
|
appId,
|
||||||
apiKey,
|
apiKey,
|
||||||
indexName,
|
indexName,
|
||||||
inputSelector: `#${id}`,
|
inputSelector: `#${id}`,
|
||||||
|
|
|
@ -41,6 +41,7 @@ export const pageQuery = graphql`
|
||||||
docSearch {
|
docSearch {
|
||||||
apiKey
|
apiKey
|
||||||
indexName
|
indexName
|
||||||
|
appId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,6 +235,7 @@ export const pageQuery = graphql`
|
||||||
docSearch {
|
docSearch {
|
||||||
apiKey
|
apiKey
|
||||||
indexName
|
indexName
|
||||||
|
appId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user