openvibers/openvibe.search Commits

Live's guides read 'Guide' in results and 'guides' on the front page (#205)

OP OpenVibers committed 11 days ago · 338accdeff · 2 files, +16 −2

Live now sends its guides as type doc (Contracts 0.278.0, Live #562); without
a kind word they would read 'Doc' and count as 'documents'.

Changes

ddiff --git a/server/web/page.js b/server/web/page.js
iindex e3937d4..0aaac7d 100644
---- a/server/web/page.js
++++ b/server/web/page.js
@@@ -230,7 +230,7 @@ const ICON_OF = { sources: 'docs', 'media-hub': 'video' };
const KIND_WORDS = {
'work/job': ['job listing', 'job listings'], 'community/paste': ['paste', 'pastes'], 'community/thread': ['forum thread', 'forum threads'],
'reviews/entity': ['place or product', 'places and products'], 'rent/city': ['rental city page', 'rental city pages'], 'rent/homes_city': ['homes city page', 'homes city pages'],
-- 'live/vod': ['recorded stream', 'recorded streams'], 'live/clip': ['clip', 'clips'], 'live/channel': ['channel', 'channels'], 'host/tld': ['domain ending', 'domain endings'],
++ 'live/vod': ['recorded stream', 'recorded streams'], 'live/clip': ['clip', 'clips'], 'live/channel': ['channel', 'channels'], 'live/doc': ['guide', 'guides'], 'host/tld': ['domain ending', 'domain endings'],
'host/plan': ['hosting plan', 'hosting plans'], 'host/provider': ['hosting provider', 'hosting providers'], 'tools/tool': ['tool', 'tools'], 'coupons/coupon': ['coupon', 'coupons'],
'coupons/merchant': ['store', 'stores'], 'help/article': ['help article', 'help articles'], 'blog/post': ['blog post', 'blog posts'], 'inventory/definition': ['item', 'items'],
'quest/quest': ['quest', 'quests'], 'bot/model': ['robot model', 'robot models'], 'wiki/page': ['wiki page', 'wiki pages'], 'news/story': ['story', 'stories'],
@@@ -707,4 +707,4 @@ function pageRouter({ searcher, auth, baseUrl = 'https://search.openvibe.network
return router;
}
--module.exports = { pageRouter, setRelease, TEXT_INDEX, robotsTxt, llmsTxt, llmsFullTxt, sitemapXml, homeJsonLd };
++module.exports = { pageRouter, setRelease, TEXT_INDEX, robotsTxt, llmsTxt, llmsFullTxt, sitemapXml, homeJsonLd, kindOf };
ddiff --git a/test/kind-words.test.js b/test/kind-words.test.js
nnew file mode 100644
iindex 0000000..00e555c
---- /dev/null
++++ b/test/kind-words.test.js
@@@ -0,0 +1,14 @@
++'use strict';
++/**
++ * What a result's kind is called (server/web/page.js kindOf): Live's guides (type doc, Contracts 0.278.0) read
++ * "Guide", not "Doc"; a kind not named falls back to its type in words.
++ *
++ * node test/kind-words.test.js
++ */
++const assert = require('assert');
++const { kindOf } = require('../server/web/page');
++
++assert.strictEqual(kindOf('live', 'doc'), 'Guide');
++assert.strictEqual(kindOf('live', 'channel'), 'Channel');
++assert.strictEqual(kindOf('someone', 'odd_kind'), 'Odd kind');
++console.log('kind words: Live guides read "Guide"');