A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: search highlighting ignores case
shuaie274fd27d6f5
diff --git a/ui/src/components/HighlightText/index.tsx b/ui/src/components/HighlightText/index.tsxindex b5acacc1..0a56865b 100644--- a/ui/src/components/HighlightText/index.tsx+++ b/ui/src/components/HighlightText/index.tsx@@ -33,7 +33,9 @@ const Index: FC<IProps> = ({ text = '', keywords = [] }) => {<span className="highlight-text">{text.split(regex).map((piece: string, index: number) => {const key = `${piece.substring(0, 6)}_${index}`;- return keywords.find((kw: string) => kw === piece) ? (+ return keywords.find(+ (kw: string) => kw.toLocaleLowerCase() === piece.toLocaleLowerCase(),+ ) ? (<mark key={key}>{piece}</mark>) : (piecediff --git a/ui/src/pages/Search/components/SearchItem/index.tsx b/ui/src/pages/Search/components/SearchItem/index.tsxindex a31dab56..2b0f002b 100644--- a/ui/src/pages/Search/components/SearchItem/index.tsx+++ b/ui/src/pages/Search/components/SearchItem/index.tsx@@ -56,7 +56,11 @@ const Index: FC<Props> = ({ data }) => {const [searchParams] = useSearchParams();const q = searchParams.get('q');- const keywords = q?.replace(Pattern.search, '').split(' ') || [];+ const keywords =+ q+ ?.replace(Pattern.search, '')+ ?.split(' ')+ ?.filter((v) => v !== '') || [];return (<ListGroupItem className="py-3 px-0 border-start-0 border-end-0 bg-transparent">