File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,6 +169,15 @@ function buildEditLink({ filePath }) {
169169 return `${ repoUrl } /bluelua.github.io/edit/main/docs/src/${ filePath } ` ;
170170}
171171
172+ function filterSearchResult ( result ) {
173+ const project = location . pathname . match ( / ^ \/ ( [ ^ / ] + ) (?: \/ | $ ) / ) ?. [ 1 ] ;
174+ if ( ! project ) {
175+ return true ;
176+ }
177+
178+ return result . id === `/${ project } /` || result . id . startsWith ( `/${ project } /` ) ;
179+ }
180+
172181export default defineConfig ( {
173182 srcDir : "./src" ,
174183 title : "BlueLua" ,
@@ -215,22 +224,7 @@ export default defineConfig({
215224 search : {
216225 provider : "local" ,
217226 options : {
218- miniSearch : {
219- searchOptions : {
220- filter ( result ) {
221- const project =
222- location . pathname . match ( / ^ \/ ( [ ^ / ] + ) (?: \/ | $ ) / ) ?. [ 1 ] ;
223- if ( ! project ) {
224- return true ;
225- }
226-
227- return (
228- result . id === `/${ project } /` ||
229- result . id . startsWith ( `/${ project } /` )
230- ) ;
231- } ,
232- } ,
233- } ,
227+ miniSearch : { searchOptions : { filter : filterSearchResult } } ,
234228 } ,
235229 } ,
236230 editLink : { pattern : buildEditLink } ,
You can’t perform that action at this time.
0 commit comments