Просмотр исходного кода

Merge pull request #7491 from weseek/fix/117050-search-results-are-not-highlighted-when-searching-for-quoteted-words

fix:  Search results are not highlighted when searching for quoteted words (PageListItemL)
Yuki Takei 3 лет назад
Родитель
Сommit
aefc36af87
2 измененных файлов с 2 добавлено и 4 удалено
  1. 0 1
      packages/app/src/interfaces/search.ts
  2. 2 3
      packages/app/src/server/service/search.ts

+ 0 - 1
packages/app/src/interfaces/search.ts

@@ -5,7 +5,6 @@ export type IPageSearchMeta = {
   elasticSearchResult?: {
   elasticSearchResult?: {
     snippet?: string | null;
     snippet?: string | null;
     highlightedPath?: string | null;
     highlightedPath?: string | null;
-    isHtmlInPath: boolean;
   };
   };
 }
 }
 
 

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

@@ -450,15 +450,14 @@ class SearchService implements SearchQueryParser, SearchResolver {
       const highlightData = data._highlight;
       const highlightData = data._highlight;
       if (highlightData != null) {
       if (highlightData != null) {
         const snippet = this.canShowSnippet(pageData, user, userGroups)
         const snippet = this.canShowSnippet(pageData, user, userGroups)
-          ? highlightData['body.en'] || highlightData['body.ja'] || highlightData['comments.en'] || highlightData['comments.ja']
+          // eslint-disable-next-line max-len
+          ? highlightData.body || highlightData['body.en'] || highlightData['body.ja'] || highlightData.comments || highlightData['comments.en'] || highlightData['comments.ja']
           : null;
           : null;
         const pathMatch = highlightData['path.en'] || highlightData['path.ja'];
         const pathMatch = highlightData['path.en'] || highlightData['path.ja'];
-        const isHtmlInPath = highlightData['path.en'] != null || highlightData['path.ja'] != null;
 
 
         elasticSearchResult = {
         elasticSearchResult = {
           snippet: snippet != null && typeof snippet[0] === 'string' ? filterXss.process(snippet) : null,
           snippet: snippet != null && typeof snippet[0] === 'string' ? filterXss.process(snippet) : null,
           highlightedPath: pathMatch != null && typeof pathMatch[0] === 'string' ? filterXss.process(pathMatch) : null,
           highlightedPath: pathMatch != null && typeof pathMatch[0] === 'string' ? filterXss.process(pathMatch) : null,
-          isHtmlInPath,
         };
         };
       }
       }