openvibers/openvibe.rent Commits

City search documents say apartments, houses, rooms (#196)

OP OpenVibers committed 11 days ago · 06cb6f2805 · 2 files, +6 −0

Changes

ddiff --git a/server/search-index.js b/server/search-index.js
iindex c2573fb..578d37f 100644
---- a/server/search-index.js
++++ b/server/search-index.js
@@@ -63,6 +63,9 @@ function describeCity(c) {
title: `Renting in ${where}`,
summary: `Typical rent in ${where}: ${sizes.slice(0, 4).join(' · ')}. Every rental site's search for ${c.name} in one place.`,
body: [`Renting in ${where}, ${c.stateName}.`, `Median gross rent by size (Census ACS ${cities.SOURCE.years}): ${sizes.join(', ')}.`,
++ // The words people search with: a host name such as Apartments.com is one token to the index, so the plain
++ // words are said too ("apartments in Portland" found no city on 2026-11-02).
++ `Apartments, houses, rooms and studios for rent in ${c.name}.`,
`Every rental site's search for ${c.name}: Craigslist, Facebook Marketplace, Zillow, Apartments.com, Zumper and more. Affordable housing, homes for sale and a fair-rent check.`].join('\n'),
facets: { state: c.state, population: c.population, rent_2br: c.rent.b2 },
authorship: { mode: 'human' },
@@@ -81,6 +84,7 @@ function describeHomesCity(c) {
title: `Buying a home in ${where}`,
summary: `${value ? `Median home value in ${where}: ${value}. ` : ''}Every for-sale site's search for ${c.name} in one place${two ? `; renting a typical 2-bedroom costs ${two} a month` : ''}.`,
body: [`Buying a home in ${where}, ${c.stateName}.`, value ? `Median value of owner-occupied homes (Census ACS ${cities.SOURCE.years}): ${value}.` : '',
++ `Houses, condos and townhomes for sale in ${c.name}.`,
`Every for-sale site's search for ${c.name}: Zillow, Realtor.com, Homes.com, Trulia and more, government and bank homes, county records and the mortgage on a typical home.`].filter(Boolean).join('\n'),
facets: { state: c.state, population: c.population, home_value: c.value },
authorship: { mode: 'human' },
ddiff --git a/test/search-index.test.js b/test/search-index.test.js
iindex 912f316..6636cc8 100644
---- a/test/search-index.test.js
++++ b/test/search-index.test.js
@@@ -68,6 +68,7 @@ const DAY = 86_400_000;
assert.match(austin.payload.title, /^Renting in Austin, TX$/);
assert.match(austin.payload.summary, /2 bedrooms \$1,845/);
assert.deepStrictEqual([austin.payload.facets.state, austin.payload.facets.rent_2br], ['TX', 1845]);
++ assert.match(austin.payload.body, /Apartments, houses, rooms and studios for rent in Austin\./, 'the words people search with (a host name is one token)');
const homes = (await outbox()).slice(before).filter((e) => e.payload && e.payload.type === 'homes_city');
assert.strictEqual(homes.length, res.homes_city.sent, 'OpenVibe.Homes\' city pages too');
const hAustin = valid(homes.find((e) => e.payload.id === 'tx-austin'));
@@@ -75,6 +76,7 @@ const DAY = 86_400_000;
assert.ok(!hAustin.payload.canonical_url.startsWith('https://openvibe.rent'), 'on the Homes host');
assert.match(hAustin.payload.title, /^Buying a home in Austin, TX$/);
assert.match(hAustin.payload.summary, /Median home value in Austin, TX: \$555,300/);
++ assert.match(hAustin.payload.body, /Houses, condos and townhomes for sale in Austin\./);
const again = await search.sweepCities();
assert.deepStrictEqual([again.city.sent, again.homes_city.sent], [0, 0], 'unchanged cities send nothing');
assert.ok(!('city' in (await search.sweep())), 'a listing sweep leaves the cities alone');