diff --git a/dashboard/src/app/artist/artist.component.html b/dashboard/src/app/artist/artist.component.html
index eb60f1c..3ffc79a 100644
--- a/dashboard/src/app/artist/artist.component.html
+++ b/dashboard/src/app/artist/artist.component.html
@@ -3,10 +3,14 @@
Debug Zone
- Returned song: {{songs.length}}
- Theorical song: {{ artist ? artist['Track Count'] : "" }}
+ Returned song: {{songs.length}}
+ Theorical song: {{ artist ? artist['Track Count'] : "" }}
+
+ Artist song: {{countSong}}
+
+
diff --git a/dashboard/src/app/artist/artist.component.ts b/dashboard/src/app/artist/artist.component.ts
index 39649d4..a1a8d3e 100644
--- a/dashboard/src/app/artist/artist.component.ts
+++ b/dashboard/src/app/artist/artist.component.ts
@@ -24,6 +24,7 @@ export class ArtistComponent implements OnInit {
songs: Array = [];
artist: Artist = new Artist();
lockLoadData = false;
+ countSong: number;
constructor(
private elsService: ElsService,
@@ -35,6 +36,9 @@ export class ArtistComponent implements OnInit {
this.route.params.subscribe((params: Params) => this.artistName = params['name']);
this.elsService.getArtist(this.artistName).subscribe(data => this.artist = data);
+
+ this.elsService.getCountArtistSong(this.artistName).subscribe(data => this.countSong = data);
+
this.loadSongs();
}
diff --git a/dashboard/src/app/els.service.ts b/dashboard/src/app/els.service.ts
index 4b4830e..184bf94 100644
--- a/dashboard/src/app/els.service.ts
+++ b/dashboard/src/app/els.service.ts
@@ -269,6 +269,23 @@ export class ElsService {
});
}
+ getCountArtistSong(artistName: string): Observable {
+ console.log('artistname: ' + artistName);
+ return this.http
+ .post(this.elsUrl + 'song' + ElsService.ACTION_COUNT,
+ JSON.stringify({
+ 'query': {
+ 'bool': {
+ 'should': [
+ {'match_phrase' : { 'Album Artist' : artistName }},
+ {'match_phrase' : { 'Artist' : artistName }}
+ ]
+ }
+ }
+ }), {headers: this.headers})
+ .map(res => res.json().count as number);
+ }
+
/** Process a result to return just one result.
* Used to get an album or an artist.
* Take a name to put in console output if no result or more than one result.