[object Object]

← back to Rentv

pr/search: fix findLinkedIn query building — a null/undefined/'' companyName (a person with no org; jobs/index.js:292 passes p.org_name) injected the LITERAL string "null"/"undefined"/empty "" into the search query, constraining it to garbage and tanking the LinkedIn match rate. Now built from non-empty trimmed quoted terms only. Verified null/undef/empty/whitespace all clean, normal queries unchanged

4cc523f8ee65ecb13abca17f922bc7aec9898f61 · 2026-08-05 21:23:57 -0700 · Steve

Files touched

Diff

commit 4cc523f8ee65ecb13abca17f922bc7aec9898f61
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Aug 5 21:23:57 2026 -0700

    pr/search: fix findLinkedIn query building — a null/undefined/'' companyName (a person with no org; jobs/index.js:292 passes p.org_name) injected the LITERAL string "null"/"undefined"/empty "" into the search query, constraining it to garbage and tanking the LinkedIn match rate. Now built from non-empty trimmed quoted terms only. Verified null/undef/empty/whitespace all clean, normal queries unchanged
---
 src/pr/adapters/search.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/pr/adapters/search.js b/src/pr/adapters/search.js
index 23278fc8..adfd7c1f 100644
--- a/src/pr/adapters/search.js
+++ b/src/pr/adapters/search.js
@@ -91,9 +91,14 @@ const adapter = register({
 
   /** Locate publicly indexed LinkedIn URLs for a person/company via site: queries. */
   async findLinkedIn({ personName, companyName, kind = 'in' }) {
-    const q = kind === 'company'
-      ? `site:linkedin.com/company "${companyName}"`
-      : `site:linkedin.com/in "${personName}" "${companyName}"`;
+    // Build from NON-EMPTY quoted terms only. A null/undefined/'' company (a person with no org, e.g.
+    // jobs/index.js passes p.org_name) must NOT inject a literal "null"/"undefined"/empty "" phrase
+    // into the query — that constrains the search to garbage and tanks the LinkedIn match rate.
+    const term = (v) => (v && String(v).trim()) ? `"${String(v).trim()}"` : null;
+    const parts = kind === 'company'
+      ? ['site:linkedin.com/company', term(companyName)]
+      : ['site:linkedin.com/in', term(personName), term(companyName)];
+    const q = parts.filter(Boolean).join(' ');
     const rep = await adapter.search(q, { numResults: 5 });
     rep.items = rep.items.filter((x) => /linkedin\.com\/(in|company)\//i.test(x.url));
     rep.result_count = rep.items.length;

← 0c981cc9 auto-save: 2026-08-05T21:15:47 (7 files) — data/deals-regist  ·  back to Rentv  ·  pr/search: Cody gate — (1) strip internal double-quotes in t 685e6ac4 →