Quellcode durchsuchen

fix highlight not working on page title & snippet

yohei0125 vor 4 Jahren
Ursprung
Commit
0a2544a710
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      packages/app/src/server/service/search.ts

+ 2 - 2
packages/app/src/server/service/search.ts

@@ -408,8 +408,8 @@ class SearchService implements SearchQueryParser, SearchResolver {
         const isHtmlInPath = highlightData['path.en'] != null || highlightData['path.ja'] != null;
 
         elasticSearchResult = {
-          snippet: typeof snippet === 'string' ? filterXss.process(snippet) : null,
-          highlightedPath: typeof pathMatch === 'string' ? filterXss.process(pathMatch) : null,
+          snippet: snippet != null && typeof snippet[0] === 'string' ? filterXss.process(snippet) : null,
+          highlightedPath: pathMatch != null && typeof pathMatch[0] === 'string' ? filterXss.process(pathMatch) : null,
           isHtmlInPath,
         };
       }