Typesense Integration Issue in Docusaurus
TLDR Benjamin experienced an error implementing Typesense (TS) in Docusaurus. Jason identified the correct placement of the 'typesense' key within the 'themeConfig' within the docusaurus config file, resolving the issue.
2
2
2
1
Aug 08, 2022 (14 months ago)
Benjamin
02:43 PMI've set up the scraper and implemented the config, .env, CSS and scraper.json.
When I try to run the site I get:
[ERROR] TypeError: Cannot read properties of undefined (reading 'searchPagePath')
I've tried adding SearchPagePath to the config and set it both to false as well as a path.
Regardless of which I get above error.
The good folks over at the Docusaurus discord suggested that I reach out here as this seems like a bug in the Typesense plugin?
Running latest both docusaurus and TS.
This is the documenation I've followed.
Jason
02:50 PMdocusaurus.config.js
?Benjamin
02:51 PMJason
02:53 PM{
// ... Other configs
themes: ['docusaurus-theme-search-typesense'],
themeConfig: {
typesense: {
searchPagePath: false,
typesenseCollectionName: 'my-website', // Replace with your own doc site's name. Should match the collection name in the scraper settings.
typesenseServerConfig: {
nodes: [
{
host: '192.168.1.34',
port: 8108,
protocol: 'http',
}
],
apiKey: 'Co8BCCK81Hd45tbBIC0UKNGBgtgDQ25aSDhgKfRK5TX0zAVs',
},
// Optional
contextualSearch: true,
},
}
// ... Other configs
}
1
Jason
02:54 PMthemeConfig
key in the top level1
Jason
02:54 PMtypesense
should just be inside that keyBenjamin
02:54 PM1
Jason
02:55 PMBenjamin
02:55 PM1
Aug 09, 2022 (14 months ago)
Benjamin
06:47 AMI've put
typesense
inside the themeConfig block, but I guess I somehow have to import this the same way that the docusaurus preset-classic is imported @type {import('@docusaurus/preset-classic').ThemeConfig}
?themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: 'My Site',
logo: {
alt: 'My Site Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'intro',
position: 'left',
label: 'Tutorial',
},
{to: '/blog', label: 'Blog', position: 'left'},
{
href: 'https://github.com/facebook/docusaurus',
label: 'GitHub',
position: 'right',
},
],
},
typesense: {
searchPagePath: false,
typesenseCollectionName: 'my-website', // Replace with your own doc site's name. Should match the collection name in the scraper settings.
typesenseServerConfig: {
nodes: [
{
host: '192.168.1.34',
port: 8108,
protocol: 'http',
}
],
apiKey: 'Co8BCCK81Hd45tbBIC0UKNGBgtgDQ25aSDhgKfRK5TX0zAVs',
},
// Optional
contextualSearch: true,
},
footer: {
style: 'dark',
links: [
Jason
07:12 AM/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
to see if that helps?Benjamin
07:13 AMBenjamin
07:20 AMBenjamin
07:23 AMBenjamin
07:42 AMBenjamin
05:01 PMJason
05:09 PM1
Jason
05:10 PM1
Benjamin
06:17 PM1
Typesense
Indexed 2779 threads (79% resolved)
Similar Threads
Configuring Docusaurus and Typesense for a Documentation Site
Apoorv had trouble adding search functionality to a Docusaurus documentation website with Typesense. Jason worked through several troubleshooting steps, identified issues with Apoorv's setup, and ultimately provided solutions that successfully implemented the search bar function.
Troubleshooting TypeSense Errors with Docusaurus Website
James experienced errors integrating TypeSense with a Docusaurus website. Kishore Nallan and Jason provided support, resolving issues with SSL, quoting in the ini file, and a missing index.
Issues with migrating search from Algolia to Typesense
Nacho encountered issues with migrating search from Algolia to Typesense, including a custom component that interfered with the search and an incorrect element being used as the title. Jason provided guidance on removing the component and adjusting search configuration.
Trouble with DocSearch Scraper and Pipenv Across Multiple OSs
James ran into errors when trying to build Typesense DocSearch Scraper from scratch, and believes itโs because of a bad Pipfile.lock. Jason attempted to replicate the error, and spent hours trying to isolate the issue but ultimately fixed the problem and copied his bash history for future reference. The conversation touches briefly on the subject of using a virtual machine for testing.
Troubleshooting Issues with DocSearch Hits and Scraper Configuration
Rubai encountered issues with search result priorities and ellipsis. Jason helped debug the issue and suggested using different versions of typesense-docsearch.js, updating initialization parameters, and running the scraper on a Linux-based environment. The issues related to hits structure and scraper configuration were resolved.