yuto-oweseek пре 4 година
родитељ
комит
7fee843e96
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      packages/app/src/components/SearchPage/SearchResultListItem.tsx

+ 1 - 1
packages/app/src/components/SearchPage/SearchResultListItem.tsx

@@ -34,9 +34,9 @@ const SearchResultListItem: FC<Props> = (props:Props) => {
   const snippet:string = page.elasticSearchResult.snippet || '';
   const snippet:string = page.elasticSearchResult.snippet || '';
 
 
   const sliceSnippet = (snippet: string): string => {
   const sliceSnippet = (snippet: string): string => {
+    // when regex pattern is not matched with less than 300 characters slicedSnippet is null
     const slicedSnippet = snippet.slice(0, MAX_SNIPPET_LENGTH).match(/^.+<\/em>/g);
     const slicedSnippet = snippet.slice(0, MAX_SNIPPET_LENGTH).match(/^.+<\/em>/g);
     return slicedSnippet != null ? slicedSnippet[0] : snippet;
     return slicedSnippet != null ? slicedSnippet[0] : snippet;
-    // return snippet;
   };
   };
 
 
   // TODO : send cetain  length of body (revisionBody) from elastisearch by adding some settings to the query and
   // TODO : send cetain  length of body (revisionBody) from elastisearch by adding some settings to the query and