mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Added profile_image property to returned search results
refs https://github.com/TryGhost/Team/issues/1665 - This piece of data is needed to display author's avatars in search results
This commit is contained in:
parent
12b58cb483
commit
09ba52039c
2 changed files with 4 additions and 1 deletions
|
@ -29,7 +29,8 @@ export default class SearchIndex {
|
|||
this.authorsIndex.addDoc({
|
||||
id: author.id,
|
||||
name: author.name,
|
||||
url: author.url
|
||||
url: author.url,
|
||||
profile_image: author.profile_image
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -71,6 +72,7 @@ export default class SearchIndex {
|
|||
this.authorsIndex = elasticlunr();
|
||||
this.authorsIndex.addField('name');
|
||||
this.authorsIndex.addField('url');
|
||||
this.authorsIndex.addField('profile_image');
|
||||
this.authorsIndex.setRef('id');
|
||||
|
||||
if (authors.authors.length > 0) {
|
||||
|
|
|
@ -87,6 +87,7 @@ describe('search index', function () {
|
|||
expect(searchResults.authors.length).toEqual(1);
|
||||
expect(searchResults.authors[0].name).toEqual('Barcelona Author');
|
||||
expect(searchResults.authors[0].url).toEqual('http://localhost/ghost/authors/barcelona-author/');
|
||||
expect(searchResults.authors[0].profile_image).toEqual('https://url_to_avatar/barcelona.png');
|
||||
|
||||
expect(searchResults.tags.length).toEqual(1);
|
||||
expect(searchResults.tags[0].name).toEqual('Barcelona Tag');
|
||||
|
|
Loading…
Add table
Reference in a new issue