From 7e8511de94a77f0d43acbd64db62fd9032ef8f10 Mon Sep 17 00:00:00 2001 From: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com> Date: Sat, 8 Aug 2026 12:17:05 +0000 Subject: [PATCH] test(node): scope PDF metadata regression to current peer --- nodejs/__test__/table.test.ts | 95 ++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/nodejs/__test__/table.test.ts b/nodejs/__test__/table.test.ts index fc77b2310..6d2d220c8 100644 --- a/nodejs/__test__/table.test.ts +++ b/nodejs/__test__/table.test.ts @@ -453,51 +453,6 @@ describe.each([arrow15, arrow16, arrow17, arrow18])( ]); }); - // https://github.com/lancedb/lancedb/issues/1963 - it("should query documents with LangChain PDF metadata", async () => { - const db = await connect(tmpDir.name); - const documents = [ - { - text: "first page", - vector: [1, 0], - source: "first.pdf", - loc: { pageNumber: 1, lines: { from: 1, to: 12 } }, - pdf: { - version: "1.10.100", - info: { - format: "PDF 1.7", - producer: "pdf.js", - creator: "Writer", - }, - totalPages: 2, - }, - }, - { - text: "second page", - vector: [0, 1], - source: "second.pdf", - loc: { pageNumber: 2, lines: { from: 13, to: 24 } }, - pdf: { - version: "1.10.100", - info: { - format: "PDF 1.7", - producer: "pdf.js", - creator: "Writer", - }, - totalPages: 2, - }, - }, - ]; - const documentsTable = await db.createTable("documents", documents); - - const results = await documentsTable.query().toArray(); - - expect(results).toHaveLength(2); - expect(results[0].source).toBe("first.pdf"); - expect(results[0].pdf.info.producer).toBe("pdf.js"); - expect(results[1].loc.pageNumber).toBe(2); - }); - it("should be able to insert nullable data for non-nullable fields", async () => { const db = await connect(tmpDir.name); const schema = new arrow.Schema([ @@ -681,6 +636,56 @@ describe.each([arrow15, arrow16, arrow17, arrow18])( }, ); +// https://github.com/lancedb/lancedb/issues/1963 +it("should query documents with LangChain PDF metadata", async () => { + const tmpDir = tmp.dirSync({ unsafeCleanup: true }); + try { + const db = await connect(tmpDir.name); + const documents = [ + { + text: "first page", + vector: [1, 0], + source: "first.pdf", + loc: { pageNumber: 1, lines: { from: 1, to: 12 } }, + pdf: { + version: "1.10.100", + info: { + format: "PDF 1.7", + producer: "pdf.js", + creator: "Writer", + }, + totalPages: 2, + }, + }, + { + text: "second page", + vector: [0, 1], + source: "second.pdf", + loc: { pageNumber: 2, lines: { from: 13, to: 24 } }, + pdf: { + version: "1.10.100", + info: { + format: "PDF 1.7", + producer: "pdf.js", + creator: "Writer", + }, + totalPages: 2, + }, + }, + ]; + const documentsTable = await db.createTable("documents", documents); + + const results = await documentsTable.query().toArray(); + + expect(results).toHaveLength(2); + expect(results[0].source).toBe("first.pdf"); + expect(results[0].pdf.info.producer).toBe("pdf.js"); + expect(results[1].loc.pageNumber).toBe(2); + } finally { + tmpDir.removeCallback(); + } +}); + describe("merge insert", () => { let tmpDir: tmp.DirResult; let table: Table;