openvibers/openvibe.work Commits
A job's Search body leaves out what its title and summary say (#179)
Changes
@@@ -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 || '',@@@ -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: [{@@@ -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');
@@ -27,7 +27,9 @@ const meta = (row) => ({
@@ -27,7 +27,9 @@ const meta = (row) => ({
url: row.url,
url: row.url,
title: row.title,
title: row.title,
company: row.company,
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,
remote: !!row.remote,
tags: String(row.tags || '').split(',').map((t) => t.trim()).filter(Boolean),
tags: String(row.tags || '').split(',').map((t) => t.trim()).filter(Boolean),
job_type: row.job_type || '',
job_type: row.job_type || '',
@@ -29,11 +29,13 @@ function describe(row) {
@@ -29,11 +29,13 @@ function describe(row) {
const src = sources.byId(row.source);
const src = sources.byId(row.source);
const where = [l.location, l.remote ? 'remote' : '', listing.jobTypeLabel(l.job_type)].filter(Boolean).join(' · ');
const where = [l.location, l.remote ? 'remote' : '', listing.jobTypeLabel(l.job_type)].filter(Boolean).join(' · ');
const excerpt = listing.plainExcerpt(row);
const excerpt = listing.plainExcerpt(row);
+ const facts = [where, l.salary].filter(Boolean).join(' · ');
return {
return {
listed: !row.expired,
listed: !row.expired,
title: `${l.title} at ${l.company}`,
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 },
facets: { source: row.source, remote: l.remote, type: listing.jobTypeLabel(l.job_type) || null, location: l.location || null },
authorship: { mode: 'imported' },
authorship: { mode: 'imported' },
provenance: [{
provenance: [{
@@ -51,7 +51,11 @@ const DAY = 86_400_000;
@@ -51,7 +51,11 @@ const DAY = 86_400_000;
assert.deepStrictEqual(doc.indexability, { decision: 'index', reasons: [] });
assert.deepStrictEqual(doc.indexability, { decision: 'index', reasons: [] });
assert.strictEqual(doc.facets.source, 'remoteok');
assert.strictEqual(doc.facets.source, 'remoteok');
assert.strictEqual(doc.facets.remote, true);
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.match(doc.summary, /\$90,000–\$130,000 a year/);
assert.deepStrictEqual(doc.provenance.map((p) => [p.service, p.type, p.label, p.url]),
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');
[['work', 'board_listing', 'RemoteOK', devops.url]], 'the board and the original listing travel with it');