openvibers/openvibe.work Commits

A job's Search body leaves out what its title and summary say (#179)

OP OpenVibers committed 11 days ago · 86212c1c49 · 3 files, +12 −4

17 of 81 Work snippets repeated a phrase: the body began with the title, company, place and pay
that the title and summary already carry, and boards write places like "Berlin, Berlin,
Deutschland" (415 of 15,520 listings). The body is the tags and the description (past the first
200 characters when those are the summary), and a place part equal to the one before it is said
once, on the page and in Search.

Changes

ddiff --git a/server/render/listing.js b/server/render/listing.js
iindex dbf3e97..0c290b7 100644
---- a/server/render/listing.js
++++ b/server/render/listing.js
@@@ -27,7 +27,9 @@ const meta = (row) => ({
url: row.url,
title: row.title,
company: row.company,
-- location: row.location || '',
++ // A board's location can repeat a part ("Berlin, Berlin, Deutschland", "Manchester, Manchester, United Kingdom":
++ // 415 of 15,520 listings on 2026-11-02); a part that equals the one before it is said once.
++ location: String(row.location || '').split(',').map((p) => p.trim()).filter((p, i, a) => p && (i === 0 || p.toLowerCase() !== a[i - 1].toLowerCase())).join(', '),
remote: !!row.remote,
tags: String(row.tags || '').split(',').map((t) => t.trim()).filter(Boolean),
job_type: row.job_type || '',
ddiff --git a/server/search-index.js b/server/search-index.js
iindex 01845ca..3b63b41 100644
---- a/server/search-index.js
++++ b/server/search-index.js
@@@ -29,11 +29,13 @@ function describe(row) {
const src = sources.byId(row.source);
const where = [l.location, l.remote ? 'remote' : '', listing.jobTypeLabel(l.job_type)].filter(Boolean).join(' · ');
const excerpt = listing.plainExcerpt(row);
++ const facts = [where, l.salary].filter(Boolean).join(' · ');
return {
listed: !row.expired,
title: `${l.title} at ${l.company}`,
-- summary: [where, l.salary].filter(Boolean).join(' · ') || excerpt.slice(0, 200) || null,
-- body: [l.title, l.company, where, l.tags.join(', '), l.salary, excerpt].filter(Boolean).join('\n'),
++ summary: facts || excerpt.slice(0, 200) || null,
++ // The body holds what the title and summary do not (the snippet reads both, and repeated the title and place).
++ body: [l.tags.join(', '), facts ? excerpt : excerpt.slice(200).replace(/^\S*\s*/, '')].filter(Boolean).join('\n'),
facets: { source: row.source, remote: l.remote, type: listing.jobTypeLabel(l.job_type) || null, location: l.location || null },
authorship: { mode: 'imported' },
provenance: [{
ddiff --git a/test/search-index.test.js b/test/search-index.test.js
iindex 76a634c..599676e 100644
---- a/test/search-index.test.js
++++ b/test/search-index.test.js
@@@ -51,7 +51,11 @@ const DAY = 86_400_000;
assert.deepStrictEqual(doc.indexability, { decision: 'index', reasons: [] });
assert.strictEqual(doc.facets.source, 'remoteok');
assert.strictEqual(doc.facets.remote, true);
-- assert.match(doc.body, /Skyward Cloud/);
++ assert.match(doc.title, /Skyward Cloud/);
++ // The snippet reads the summary and body together: the body leaves out the title, company, place and pay.
++ assert.ok(!doc.body.includes(devops.title) && !doc.body.includes('Skyward Cloud') && !doc.body.includes('$90,000'), `no repeat: ${doc.body.slice(0, 120)}`);
++ const { meta } = require('../server/render/listing');
++ assert.strictEqual(meta({ ...devops, location: 'Berlin, Berlin, Deutschland' }).location, 'Berlin, Deutschland', 'a repeated place part is said once');
assert.match(doc.summary, /\$90,000–\$130,000 a year/);
assert.deepStrictEqual(doc.provenance.map((p) => [p.service, p.type, p.label, p.url]),
[['work', 'board_listing', 'RemoteOK', devops.url]], 'the board and the original listing travel with it');