File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
packages/fern-docs/search-server/src/turbopuffer Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -5,15 +5,16 @@ export function toDocuments(results: FernTurbopufferRecord[]): string[] {
5
5
return uniqBy (
6
6
results . map ( ( result ) => {
7
7
const code_snippets = zipWith (
8
- result . attributes . code_snippets ?? [ ] ,
9
- result . attributes . code_snippet_langs ?? [ ] ,
8
+ result . attributes . code_snippets ?. filter ( ( snippet ) => snippet . length < 1000 ) ?? [ ] ,
9
+ result . attributes . code_snippet_langs ?. filter ( ( lang ) => lang . length < 1000 ) ?? [ ] ,
10
10
( snippet , lang ) => {
11
11
const lang_str : string = lang ?? "" ;
12
12
return `\`\`\`${ lang_str } \n${ snippet } \n\`\`\`` ;
13
13
}
14
14
) . join ( "\n\n" ) ;
15
15
return {
16
16
canonicalPathname : result . attributes . canonicalPathname ,
17
+ chunk : result . attributes . chunk ,
17
18
domain : result . attributes . domain ,
18
19
pathname : result . attributes . pathname ,
19
20
hash : result . attributes . hash ,
@@ -31,6 +32,6 @@ export function toDocuments(results: FernTurbopufferRecord[]): string[] {
31
32
( result ) => `${ result . pathname } ${ result . hash } - ${ result . page_position } `
32
33
) . map (
33
34
( result ) =>
34
- `# ${ result . title } \n Source: ${ result . domain } ${ result . pathname } ${ result . hash ?? "" } \n\n${ result . description } ${ result . content } ${ result . code_snippets } `
35
+ `# ${ result . title } \n Source: ${ result . domain } ${ result . pathname } ${ result . hash ?? "" } \n\n${ result . chunk } ${ result . description } ${ result . content } ${ result . code_snippets } `
35
36
) ;
36
37
}
You can’t perform that action at this time.
0 commit comments