1111 private const array SPECIAL_ENDING_CHARS = ['= ' , '* ' , '? ' , '+ ' , '> ' , '< ' , '! ' ];
1212
1313 public function __construct (
14- private ApiFacadeInterface $ apiFacade
14+ private ApiFacadeInterface $ apiFacade,
1515 ) {
1616 }
1717
@@ -62,9 +62,8 @@ public function generateSearchIndex(): array
6262
6363 // Add documentation files to search index
6464 $ documentationItems = $ this ->generateDocumentationSearchItems ();
65- $ result = array_merge ($ result , $ documentationItems );
6665
67- return $ result ;
66+ return array_merge ( $ result, $ documentationItems ) ;
6867 }
6968
7069 /**
@@ -83,8 +82,8 @@ private function formatDescription(string $desc): string
8382 private function generateDocumentationSearchItems (): array
8483 {
8584 $ result = [];
86- $ documentationPath = __DIR__ . '/../../../../../ content/documentation ' ;
87-
85+ $ documentationPath = __DIR__ . '/../../../../content/documentation ' ;
86+
8887 if (!is_dir ($ documentationPath )) {
8988 error_log ("Documentation path not found: " . $ documentationPath );
9089 return [];
@@ -95,31 +94,31 @@ private function generateDocumentationSearchItems(): array
9594 error_log ("Could not scan documentation directory: " . $ documentationPath );
9695 return [];
9796 }
98-
97+
9998 foreach ($ files as $ file ) {
10099 if (pathinfo ($ file , PATHINFO_EXTENSION ) !== 'md ' || $ file === '_index.md ' ) {
101100 continue ;
102101 }
103-
102+
104103 $ filePath = $ documentationPath . '/ ' . $ file ;
105104 $ content = file_get_contents ($ filePath );
106-
105+
107106 // Extract title from frontmatter
108107 $ title = pathinfo ($ file , PATHINFO_FILENAME );
109108 if (preg_match ('/title = "([^"]+)"/ ' , $ content , $ matches )) {
110109 $ title = $ matches [1 ];
111110 }
112-
111+
113112 // Remove frontmatter
114113 $ content = preg_replace ('/\+\+\+.*?\+\+\+/s ' , '' , $ content );
115-
114+
116115 // Remove markdown formatting and clean content
117116 $ content = preg_replace ('/[#`*\[\]()]/ ' , ' ' , $ content );
118117 $ content = preg_replace ('/\s+/ ' , ' ' , trim ($ content ));
119-
118+
120119 // Limit content length for search index
121120 $ content = substr ($ content , 0 , 500 );
122-
121+
123122 $ result [] = [
124123 'id ' => 'doc_ ' . pathinfo ($ file , PATHINFO_FILENAME ),
125124 'title ' => $ title ,
0 commit comments