Skip to content

Commit 1046a5e

Browse files
arturfracalaArtur Fracala
and
Artur Fracala
authored
fix: search do not display to what relates displayed method (DPS-4431) (#1555)
* fix: search do not display to what relates displayed method * fix: delete console log --------- Co-authored-by: Artur Fracala <[email protected]>
1 parent fd0cb98 commit 1046a5e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/components/core/Search/index.js

+17
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,28 @@ const transformHits = (hits) => {
2424
const path = hit.url.replace("https://platform.text.com/docs", "");
2525
const url = window.location.origin + pathExt + path;
2626

27+
const updatedSnippetResult = hit._snippetResult
28+
? {
29+
...hit._snippetResult,
30+
hierarchy: Object.fromEntries(
31+
Object.entries(
32+
hit._snippetResult.hierarchy || {}
33+
).map(([key, value]) => [
34+
key,
35+
value.matchLevel === "none"
36+
? { ...value, value: content }
37+
: value,
38+
])
39+
),
40+
}
41+
: hit._snippetResult;
42+
2743
if (content)
2844
return {
2945
...hit,
3046
content: content,
3147
url,
48+
_snippetResult: updatedSnippetResult,
3249
};
3350

3451
return {

src/constants/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ const UNCLEAR_SEARCH_MATCHES = [
708708
content: "Configuration API",
709709
},
710710
{ regex: /data-reporting/g, content: "Reports API" },
711+
{ regex: /customer-sdk/g, content: "Customer SDK" },
711712
];
712713

713714
const constants = {

0 commit comments

Comments
 (0)