diff --git a/aio/src/app/search/search.worker.ts b/aio/src/app/search/search.worker.ts index d31a5ce935..0874763303 100644 --- a/aio/src/app/search/search.worker.ts +++ b/aio/src/app/search/search.worker.ts @@ -22,7 +22,7 @@ interface PageInfo { } interface EncodedPages { - dictionary: string[]; + dictionary: string; pages: EncodedPage[]; } @@ -91,11 +91,12 @@ function makeRequest(url: string, callback: (response: any) => void): void { // Create the search index from the searchInfo which contains the information about each page to be // indexed function loadIndex({dictionary, pages}: EncodedPages): IndexLoader { + const dictionaryArray = dictionary.split(' '); return (indexBuilder: lunr.Builder) => { // Store the pages data to be used in mapping query results back to pages // Add search terms from each page to the search index pages.forEach(encodedPage => { - const page = decodePage(encodedPage, dictionary); + const page = decodePage(encodedPage, dictionaryArray); indexBuilder.add(page); pageMap[page.path] = page; }); diff --git a/aio/tools/transforms/angular-base-package/processors/generateKeywords.js b/aio/tools/transforms/angular-base-package/processors/generateKeywords.js index d5141d88d1..54f0398a20 100644 --- a/aio/tools/transforms/angular-base-package/processors/generateKeywords.js +++ b/aio/tools/transforms/angular-base-package/processors/generateKeywords.js @@ -87,7 +87,7 @@ module.exports = function generateKeywordsProcessor(log) { // Now process all the search data and collect it up to be used in creating a new document const searchData = { - dictionary: Array.from(dictionary.keys()), + dictionary: Array.from(dictionary.keys()).join(' '), pages: filteredDocs.map(page => { // Copy the properties from the searchTerms object onto the search data object const searchObj = { diff --git a/aio/tools/transforms/angular-base-package/processors/generateKeywords.spec.js b/aio/tools/transforms/angular-base-package/processors/generateKeywords.spec.js index 3065a1c16e..88d35ee2ae 100644 --- a/aio/tools/transforms/angular-base-package/processors/generateKeywords.spec.js +++ b/aio/tools/transforms/angular-base-package/processors/generateKeywords.spec.js @@ -73,7 +73,7 @@ describe('generateKeywords processor', () => { ]; processor.$process(docs); expect(docs[docs.length - 1].data).toEqual({ - dictionary: [ 'fooclass', 'barinterfac', 'captur', 'content' ], + dictionary: 'fooclass barinterfac captur content', pages: [ jasmine.objectContaining({ title: 'FooClass', type: 'class', keywords: [0] }), jasmine.objectContaining({ title: 'BarInterface', type: 'interface', keywords: [1, 2, 3] }), @@ -93,7 +93,7 @@ describe('generateKeywords processor', () => { ]; processor.$process(docs); expect(docs[docs.length - 1].data).toEqual({ - dictionary: ['class', 'fooclass', 'content', 'insid', 'tabl'], + dictionary: 'class fooclass content insid tabl', pages: [ jasmine.objectContaining({keywords: [0, 1, 2, 3, 4] }) ], @@ -142,7 +142,7 @@ describe('generateKeywords processor', () => { processor.$process(docs); const keywordsDoc = docs[docs.length - 1]; expect(keywordsDoc.data).toEqual({ - dictionary: ['class', 'publicexport', 'head', 'secondari'], + dictionary: 'class publicexport head secondari', pages: [ jasmine.objectContaining({ headings: [2, 3, 2] }) ] @@ -175,7 +175,7 @@ describe('generateKeywords processor', () => { processor.$process(docs); const keywordsDoc = docs[docs.length - 1]; expect(keywordsDoc.data).toEqual({ - dictionary: ['class', 'publicexport', 'content', 'ngclass', 'instancemethoda','instancepropertya','instancemethodb','instancepropertyb','staticmethoda','staticpropertya','staticmethodb','staticpropertyb', 'head'], + dictionary: 'class publicexport content ngclass instancemethoda instancepropertya instancemethodb instancepropertyb staticmethoda staticpropertya staticmethodb staticpropertyb head', pages: [ jasmine.objectContaining({ members: [4, 5, 6, 7, 8, 9, 10, 11] @@ -220,7 +220,7 @@ describe('generateKeywords processor', () => { processor.$process(docs); const keywordsDoc = docs[docs.length - 1]; expect(keywordsDoc.data).toEqual({ - dictionary: ['class', 'child', 'childmember1', 'childmember2', 'parentmember1', 'parentmember2', 'parentmember3', 'parentclass', 'interfac', 'parentinterfac'], + dictionary: 'class child childmember1 childmember2 parentmember1 parentmember2 parentmember3 parentclass interfac parentinterfac', pages: [ jasmine.objectContaining({ title: 'Child', @@ -252,7 +252,7 @@ describe('generateKeywords processor', () => { processor.$process(docs); const keywordsDoc = docs[docs.length - 1]; expect(keywordsDoc.data).toEqual({ - dictionary: ['class', 'publicexport', 'ngcontrol', 'control', 'content', 'ngclass', 'ngmodel', 'model'], + dictionary: 'class publicexport ngcontrol control content ngclass ngmodel model', pages: [ jasmine.objectContaining({ headings: [6, 7], @@ -284,7 +284,7 @@ describe('generateKeywords processor', () => { processor.$process(docs); const keywordsDoc = docs[docs.length - 1]; expect(JSON.parse(keywordsDoc.renderedContent)).toEqual({ - dictionary: ['class', 'someclass', 'document', 'api', 'head', 'someclass2', 'descript', 'member1'], + dictionary: 'class someclass document api head someclass2 descript member1', pages: [{ 'title':'SomeClass', 'type':'class',