Skip to content

Commit

Permalink
feat(data): add concatenated name
Browse files Browse the repository at this point in the history
fixes #33
  • Loading branch information
Haroenv committed Mar 28, 2017
1 parent 758685b commit 72ab12e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ const defaultConfig = {
searchableAttributes: [
'unordered(popularName)',
'unordered(name)',
'unordered(concatenatedName)',
'unordered(description)',
'unordered(keywords)',
'owner.name',
'owners.name',
],
attributesForFaceting: ['onlyFilter(name)', 'keywords'], // optionalFacetFilters to boost the name
attributesForFaceting: [
'onlyFilter(name)' /* to be removed when frontend concatenates */,
'onlyFilter(concatenatedName)' /* optionalFacetFilters to boost the name */,
'keywords',
],
customRanking: ['desc(downloadsLast30Days)'],
disablePrefixOnAttributes: ['keywords', 'owner.name', 'owners.name'],
disableExactOnAttributes: [
Expand Down
3 changes: 2 additions & 1 deletion formatPkg.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ export default function formatPkg(pkg) {
}

const dependencies = cleaned.dependencies || {};
const concatenatedName = cleaned.name.replace(/[-/@_.]+/g, '');

const rawPkg = {
objectID: cleaned.name,
name: cleaned.name,
numberOfWordsInName: cleaned.name.split(/[-/@_]+/).length,
concatenatedName,
downloadsLast30Days: 0,
downloadsRatio: 0,
humanDownloadsLast30Days: numeral(0).format('0.[0]a'),
Expand Down

0 comments on commit 72ab12e

Please sign in to comment.