Shun Miyazawa пре 3 година
родитељ
комит
6fc59f3532
2 измењених фајлова са 2 додато и 9 уклоњено
  1. 0 2
      packages/app/src/interfaces/search.ts
  2. 2 7
      packages/app/src/server/service/search.ts

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

@@ -44,5 +44,3 @@ export const SORT_ORDER = {
   ASC: 'asc',
   ASC: 'asc',
 } as const;
 } as const;
 export type SORT_ORDER = typeof SORT_ORDER[keyof typeof SORT_ORDER];
 export type SORT_ORDER = typeof SORT_ORDER[keyof typeof SORT_ORDER];
-
-export const MAX_HIGHLITE_PAGE_PATH_FRAGMENT_SIZE = 250;

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

@@ -3,9 +3,7 @@ import xss from 'xss';
 
 
 import { SearchDelegatorName } from '~/interfaces/named-query';
 import { SearchDelegatorName } from '~/interfaces/named-query';
 import { IPageHasId } from '~/interfaces/page';
 import { IPageHasId } from '~/interfaces/page';
-import {
-  IFormattedSearchResult, IPageWithSearchMeta, ISearchResult, MAX_HIGHLITE_PAGE_PATH_FRAGMENT_SIZE,
-} from '~/interfaces/search';
+import { IFormattedSearchResult, IPageWithSearchMeta, ISearchResult } from '~/interfaces/search';
 import loggerFactory from '~/utils/logger';
 import loggerFactory from '~/utils/logger';
 
 
 import { ObjectIdLike } from '../interfaces/mongoose-utils';
 import { ObjectIdLike } from '../interfaces/mongoose-utils';
@@ -457,12 +455,9 @@ class SearchService implements SearchQueryParser, SearchResolver {
         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;
         const isHtmlInPath = highlightData['path.en'] != null || highlightData['path.ja'] != null;
 
 
-        const highlightedPath = pathMatch != null && typeof pathMatch[0] === 'string' ? pathMatch[0] : null;
-        const shouldHighlight = highlightedPath != null && MAX_HIGHLITE_PAGE_PATH_FRAGMENT_SIZE >= pageData.path.length;
-
         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: shouldHighlight ? filterXss.process(highlightedPath) : null,
+          highlightedPath: pathMatch != null && typeof pathMatch[0] === 'string' ? filterXss.process(pathMatch) : null,
           isHtmlInPath,
           isHtmlInPath,
         };
         };
       }
       }