build(aio): add API static members to search index (#21988)
Previously searching for `compose` did not include `Validators` in the search results because we were not including all the `static` members of API docs in the index. PR Close #21988
This commit is contained in:

committed by
Alex Rickabaugh

parent
ae7bc2238d
commit
9a0700f5bd
@ -97,7 +97,7 @@ module.exports = function generateKeywordsProcessor(log, readFilesProcessor) {
|
||||
|
||||
// Special case properties that contain content relating to "members"
|
||||
// of a doc that represents, say, a class or interface
|
||||
if (key === 'methods' || key === 'properties' || key === 'events') {
|
||||
if (key === 'members' || key === 'statics') {
|
||||
value.forEach(function(member) { extractWords(member.name, members, membersMap); });
|
||||
}
|
||||
});
|
||||
|
@ -98,6 +98,36 @@ describe('generateKeywords processor', () => {
|
||||
expect(keywordsDoc.data[0].headingWords).toEqual('heading important secondary');
|
||||
});
|
||||
|
||||
it('should add member doc properties to the search terms', () => {
|
||||
const processor = processorFactory(mockLogger, mockReadFilesProcessor);
|
||||
const docs = [
|
||||
{
|
||||
docType: 'class',
|
||||
name: 'PublicExport',
|
||||
searchTitle: 'class PublicExport',
|
||||
vFile: { headings: { h2: ['heading A'] } },
|
||||
content: 'Some content with ngClass in it.',
|
||||
members: [
|
||||
{ name: 'instanceMethodA' },
|
||||
{ name: 'instancePropertyA' },
|
||||
{ name: 'instanceMethodB' },
|
||||
{ name: 'instancePropertyB' },
|
||||
],
|
||||
statics: [
|
||||
{ name: 'staticMethodA' },
|
||||
{ name: 'staticPropertyA' },
|
||||
{ name: 'staticMethodB' },
|
||||
{ name: 'staticPropertyB' },
|
||||
],
|
||||
},
|
||||
];
|
||||
processor.$process(docs);
|
||||
const keywordsDoc = docs[docs.length - 1];
|
||||
expect(keywordsDoc.data[0].members).toEqual(
|
||||
'instancemethoda instancemethodb instancepropertya instancepropertyb staticmethoda staticmethodb staticpropertya staticpropertyb'
|
||||
);
|
||||
});
|
||||
|
||||
it('should process terms prefixed with "ng" to include the term stripped of "ng"', () => {
|
||||
const processor = processorFactory(mockLogger, mockReadFilesProcessor);
|
||||
const docs = [
|
||||
|
Reference in New Issue
Block a user