@@ -11,6 +11,7 @@ export interface SearchResult {
1111 title : string | null ;
1212 content : string ;
1313 contentType : string ;
14+ pageNumber : number | null ;
1415 score : number ;
1516}
1617
@@ -39,7 +40,7 @@ export function createDb(connectionString: string) {
3940 let results : Record < string , unknown > [ ] ;
4041 if ( partNumber !== undefined && contentType ) {
4142 results = await sql `
42- SELECT id, part_number, section_id, title, content, content_type,
43+ SELECT id, part_number, section_id, title, content, content_type, page_number,
4344 1 - (embedding <=> ${ embeddingStr } ::vector) as score
4445 FROM spec_content
4546 WHERE embedding IS NOT NULL
@@ -50,7 +51,7 @@ export function createDb(connectionString: string) {
5051 ` ;
5152 } else if ( partNumber !== undefined ) {
5253 results = await sql `
53- SELECT id, part_number, section_id, title, content, content_type,
54+ SELECT id, part_number, section_id, title, content, content_type, page_number,
5455 1 - (embedding <=> ${ embeddingStr } ::vector) as score
5556 FROM spec_content
5657 WHERE embedding IS NOT NULL
@@ -60,7 +61,7 @@ export function createDb(connectionString: string) {
6061 ` ;
6162 } else if ( contentType ) {
6263 results = await sql `
63- SELECT id, part_number, section_id, title, content, content_type,
64+ SELECT id, part_number, section_id, title, content, content_type, page_number,
6465 1 - (embedding <=> ${ embeddingStr } ::vector) as score
6566 FROM spec_content
6667 WHERE embedding IS NOT NULL
@@ -70,7 +71,7 @@ export function createDb(connectionString: string) {
7071 ` ;
7172 } else {
7273 results = await sql `
73- SELECT id, part_number, section_id, title, content, content_type,
74+ SELECT id, part_number, section_id, title, content, content_type, page_number,
7475 1 - (embedding <=> ${ embeddingStr } ::vector) as score
7576 FROM spec_content
7677 WHERE embedding IS NOT NULL
@@ -86,6 +87,7 @@ export function createDb(connectionString: string) {
8687 title : r . title as string | null ,
8788 content : r . content as string ,
8889 contentType : r . content_type as string ,
90+ pageNumber : r . page_number as number | null ,
8991 score : r . score as number ,
9092 } ) ) ;
9193 } ,
0 commit comments