Make search work with category names (#4103)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
const Joi = require('@hapi/joi')
|
||||
const pathToRegexp = require('path-to-regexp')
|
||||
const categories = require('../../services/categories')
|
||||
const coalesceBadge = require('./coalesce-badge')
|
||||
const { makeFullUrl } = require('./route')
|
||||
|
||||
@@ -154,7 +155,9 @@ function transformExample(inExample, index, ServiceClass) {
|
||||
style: style === 'flat' ? undefined : style,
|
||||
namedLogo,
|
||||
},
|
||||
keywords,
|
||||
keywords: keywords.concat(
|
||||
categories.find(c => c.id === ServiceClass.category).keywords
|
||||
),
|
||||
documentation: documentation ? { __html: documentation } : undefined,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ test(transformExample, function() {
|
||||
defaultBadgeData: {
|
||||
label: 'downloads',
|
||||
},
|
||||
category: 'platform-support',
|
||||
}
|
||||
|
||||
given(
|
||||
@@ -109,7 +110,7 @@ test(transformExample, function() {
|
||||
namedLogo: undefined,
|
||||
style: undefined,
|
||||
},
|
||||
keywords: ['hello'],
|
||||
keywords: ['hello', 'platform'],
|
||||
documentation: undefined,
|
||||
})
|
||||
|
||||
@@ -135,7 +136,7 @@ test(transformExample, function() {
|
||||
namedLogo: undefined,
|
||||
style: undefined,
|
||||
},
|
||||
keywords: ['hello'],
|
||||
keywords: ['hello', 'platform'],
|
||||
documentation: undefined,
|
||||
})
|
||||
|
||||
@@ -162,7 +163,7 @@ test(transformExample, function() {
|
||||
namedLogo: undefined,
|
||||
style: undefined,
|
||||
},
|
||||
keywords: ['hello'],
|
||||
keywords: ['hello', 'platform'],
|
||||
documentation: undefined,
|
||||
})
|
||||
})
|
||||
|
||||
@@ -66,6 +66,7 @@ const serviceDefinitionExport = Joi.object({
|
||||
Joi.object({
|
||||
id: Joi.string().required(),
|
||||
name: Joi.string().required(),
|
||||
keywords: arrayOfStrings,
|
||||
})
|
||||
)
|
||||
.required(),
|
||||
|
||||
Reference in New Issue
Block a user