Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[experimental] MeiliSearch#2744

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
pwizla wants to merge40 commits intomainfromrepo/test-meilisearch-search
Closed
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
40 commits
Select commitHold shift + click to select a range
d9c9750
Add MeiliSearch-related files and update config.
pwizlaSep 16, 2025
cf2282c
Fix MeiliSearch scraper config. location
pwizlaSep 16, 2025
7fac8c8
Add MeiliSearch package to files
pwizlaSep 16, 2025
2c902cb
Fix scraper commands in workflow
pwizlaSep 16, 2025
5112771
Swap with custom front-end component
pwizlaSep 16, 2025
725a4b8
WIP
pwizlaSep 17, 2025
6373b66
Fix front end errors
pwizlaSep 18, 2025
26ad431
Tidy up CustomSearchBar.js code
pwizlaSep 23, 2025
7916839
Try to match existing search design style
pwizlaSep 23, 2025
e116655
Hide shortcut for search + try to fix alignment
pwizlaSep 23, 2025
72302f3
Ensure Search and AI are both 50% of the input
pwizlaSep 23, 2025
df71b6a
Fix mobile design
pwizlaSep 23, 2025
dfe2ee0
Try to fix border-bottom on mobile
pwizlaSep 23, 2025
c8138e2
Ensure proper unmounting of component while switching between dark/li…
pwizlaSep 23, 2025
655fbe4
Fix wrong search placeholder text color in dark mode
pwizlaSep 23, 2025
9d3ee44
Edit scraping config
pwizlaSep 24, 2025
0db2811
Fix scrapping - only works for some categories for now
pwizlaSep 24, 2025
4f9ee44
Fix matching all words
pwizlaSep 24, 2025
815e235
Don't highlight with this ugly yellow
pwizlaSep 24, 2025
650751f
Scrap all pages
pwizlaSep 24, 2025
4becb57
Improve scraping config to ensure h1s are displayed first
pwizlaSep 25, 2025
6af59bb
Properly display categories based on breadcrumbs
pwizlaOct 2, 2025
2e9358a
WIP: Start handling categories for pages without breadcrumbs
pwizlaOct 2, 2025
8e669db
Add all categories
pwizlaOct 3, 2025
653cc72
Change rankingRules order to hopefully have h1s first
pwizlaOct 3, 2025
c021216
Add categories ranking
pwizlaOct 6, 2025
488ff1b
Improve modal styles
pwizlaOct 6, 2025
b3c73ec
Fix API vs. APIs category
pwizlaOct 6, 2025
e1ee50b
Use dynamic import to prevent build issues with solid-js
pwizlaOct 7, 2025
b121c35
Add CMS intro and Cloud intro to categories
pwizlaOct 8, 2025
160ab7b
Delete an old file found through search 👀
pwizlaOct 8, 2025
406a882
Fix category typo API → APIs
pwizlaOct 8, 2025
47a43c6
Add script to analyze categories
pwizlaOct 8, 2025
e4cb3c8
Improve script to analyze categories
pwizlaOct 8, 2025
03d7ef0
Improve scraper config to better handle pages without categories
pwizlaOct 8, 2025
a48d577
Don't index "docusaurus skip to content fallback"
pwizlaOct 8, 2025
9c674c7
Move community pages to Getting Started category
pwizlaOct 8, 2025
f759b77
Revert "Don't index "docusaurus skip to content fallback""
pwizlaOct 8, 2025
35cb9a9
Index release notes
pwizlaOct 8, 2025
62db386
Fix trailing slashes in URLs
pwizlaOct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Use dynamic import to prevent build issues with solid-js
  • Loading branch information
@pwizla
pwizla committedOct 7, 2025
commite1ee50b3102c19daa0c127727cc9ec7adeedabea
5 changes: 3 additions & 2 deletionsdocusaurus/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,7 @@
"generate-llms": "node scripts/generate-llms.js",
"dev:with-llms": "yarn generate-llms && docusaurus start --port 8080 --no-open",
"build:with-llms": "yarn generate-llms && docusaurus build",
"meilisearch:update-order": "node -r dotenv/config scripts/meilisearch/add-category-order.js"
"meilisearch:update-order": "node -r dotenv/config scripts/meilisearch/add-category-order.js"
},
"dependencies": {
"@amplitude/analytics-browser": "^2.12.2",
Expand DownExpand Up@@ -49,7 +49,8 @@
"qs": "^6.11.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": ">=1.58.3 <2.0.0"
"sass": ">=1.58.3 <2.0.0",
"solid-js": "^1.9.9"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.5.2",
Expand Down
197 changes: 105 additions & 92 deletionsdocusaurus/src/theme/SearchBar/index.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
import React, { useEffect, useRef } from 'react';
import { docsearch } from 'meilisearch-docsearch';
import React, { useEffect, useRef, useState } from 'react';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import { useColorMode } from '@docusaurus/theme-common';
import'meilisearch-docsearch/css';
importBrowserOnly from '@docusaurus/BrowserOnly';

export defaultfunctionSearchBar() {
functionSearchBarContent() {
const { siteConfig } = useDocusaurusContext();
const { colorMode } = useColorMode();
const searchButtonRef = useRef(null);
const dropdownRef = useRef(null);
const searchInstanceRef = useRef(null);
const [isLoaded, setIsLoaded] = useState(false);

useEffect(() => {
if (!searchButtonRef.current) {
Expand All@@ -25,103 +25,108 @@ export default function SearchBar() {
// Clear the container content
searchButtonRef.current.innerHTML = '';

const search = docsearch({
container: searchButtonRef.current,
host: siteConfig.customFields.meilisearch.host,
apiKey: siteConfig.customFields.meilisearch.apiKey,
indexUid: siteConfig.customFields.meilisearch.indexUid,

// Transform search results
transformItems: (items) => {
return items.map((item) => {
let section = item.hierarchy_lvl0 || 'Documentation';

if (item.url && item.url.includes('/cms/')) {
section = 'CMS';
} else if (item.url && item.url.includes('/cloud/')) {
section = 'Cloud';
}

return {
...item,
url: item.url.replace('https://docs.strapi.io', ''),
hierarchy: {
lvl0: section,
lvl1: item.hierarchy_lvl0, // La section (Backend customization, etc.)
lvl2: item.hierarchy_lvl1, // Le titre de la page
lvl3: item.hierarchy_lvl2
// Dynamic import to avoid SSR issues with solid-js
Promise.all([
import('meilisearch-docsearch'),
import('meilisearch-docsearch/css')
]).then(([{ docsearch }]) => {
const search = docsearch({
container: searchButtonRef.current,
host: siteConfig.customFields.meilisearch.host,
apiKey: siteConfig.customFields.meilisearch.apiKey,
indexUid: siteConfig.customFields.meilisearch.indexUid,

transformItems: (items) => {
return items.map((item) => {
let section = item.hierarchy_lvl0 || 'Documentation';

if (item.url && item.url.includes('/cms/')) {
section = 'CMS';
} else if (item.url && item.url.includes('/cloud/')) {
section = 'Cloud';
}
};
});
},

// Customize search parameters
searchParams: {
attributesToHighlight: ['hierarchy', 'content'],
highlightPreTag: '<mark>',
highlightPostTag: '</mark>',
matchingStrategy: 'all',
attributesToSearchOn: ['hierarchy_lvl1', 'hierarchy_lvl2', 'content']
},

return {
...item,
url: item.url.replace('https://docs.strapi.io', ''),
hierarchy: {
lvl0: section,
lvl1: item.hierarchy_lvl0,
lvl2: item.hierarchy_lvl1,
lvl3: item.hierarchy_lvl2
}
};
});
},

placeholder: 'Search documentation...',
translations: {
button: {
buttonText: 'Search',
buttonAriaLabel: 'Search',
searchParams: {
attributesToHighlight: ['hierarchy', 'content'],
highlightPreTag: '<mark>',
highlightPostTag: '</mark>',
matchingStrategy: 'all',
attributesToSearchOn: ['hierarchy_lvl1', 'hierarchy_lvl2', 'content']
},
modal: {
searchBox: {
resetButtonTitle: 'Clear the query',
resetButtonAriaLabel: 'Clear the query',
cancelButtonText: 'Cancel',
cancelButtonAriaLabel: 'Cancel',
},
startScreen: {
recentSearchesTitle: 'Recent',
noRecentSearchesText: 'No recent searches',
saveRecentSearchButtonTitle: 'Save this search',
removeRecentSearchButtonTitle: 'Remove this search',
favoriteSearchesTitle: 'Favorite',
removeFavoriteSearchButtonTitle: 'Remove this search from favorites',
},
errorScreen: {
titleText: 'Unable to fetch results',
helpText: 'You might want to check your network connection.',
},
footer: {
selectText: 'to select',
selectKeyAriaLabel: 'Enter key',
navigateText: 'to navigate',
navigateUpKeyAriaLabel: 'Arrow up',
navigateDownKeyAriaLabel: 'Arrow down',
closeText: 'to close',
closeKeyAriaLabel: 'Escape key',
searchByText: 'Search by',

placeholder: 'Search documentation...',
translations: {
button: {
buttonText: 'Search',
buttonAriaLabel: 'Search',
},
noResultsScreen: {
noResultsText: 'No results for',
suggestedQueryText: 'Try searching for',
reportMissingResultsText: 'Believe this query should return results?',
reportMissingResultsLinkText: 'Let us know.',
modal: {
searchBox: {
resetButtonTitle: 'Clear the query',
resetButtonAriaLabel: 'Clear the query',
cancelButtonText: 'Cancel',
cancelButtonAriaLabel: 'Cancel',
},
startScreen: {
recentSearchesTitle: 'Recent',
noRecentSearchesText: 'No recent searches',
saveRecentSearchButtonTitle: 'Save this search',
removeRecentSearchButtonTitle: 'Remove this search',
favoriteSearchesTitle: 'Favorite',
removeFavoriteSearchButtonTitle: 'Remove this search from favorites',
},
errorScreen: {
titleText: 'Unable to fetch results',
helpText: 'You might want to check your network connection.',
},
footer: {
selectText: 'to select',
selectKeyAriaLabel: 'Enter key',
navigateText: 'to navigate',
navigateUpKeyAriaLabel: 'Arrow up',
navigateDownKeyAriaLabel: 'Arrow down',
closeText: 'to close',
closeKeyAriaLabel: 'Escape key',
searchByText: 'Search by',
},
noResultsScreen: {
noResultsText: 'No results for',
suggestedQueryText: 'Try searching for',
reportMissingResultsText: 'Believe this query should return results?',
reportMissingResultsLinkText: 'Let us know.',
},
},
},
},

getMissingResultsUrl: ({ query }) => {
return `https://github.com/strapi/documentation/issues/new?title=Missing+search+results+for+${query}`;
},
});
getMissingResultsUrl: ({ query }) => {
return `https://github.com/strapi/documentation/issues/new?title=Missing+search+results+for+${query}`;
},
});

// Store the search instance
searchInstanceRef.current = search;
searchInstanceRef.current = search;
setIsLoaded(true);

// Add dark mode class when needed
if (colorMode === 'dark') {
dropdownRef.current?.classList.add('dark');
} else {
dropdownRef.current?.classList.remove('dark');
}
if (colorMode === 'dark') {
dropdownRef.current?.classList.add('dark');
} else {
dropdownRef.current?.classList.remove('dark');
}
}).catch((error) => {
console.error('Failed to load MeiliSearch:', error);
});

return () => {
if (searchInstanceRef.current) {
Expand All@@ -136,4 +141,12 @@ export default function SearchBar() {
<div ref={searchButtonRef}></div>
</div>
);
}

export default function SearchBar() {
return (
<BrowserOnly fallback={<div className="navbar__search"><div></div></div>}>
{() => <SearchBarContent />}
</BrowserOnly>
);
}
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp