diff --git a/src/Meilisearch/Extensions/StringExtensions.cs b/src/Meilisearch/Extensions/StringExtensions.cs index b930e501..c8c58aa8 100644 --- a/src/Meilisearch/Extensions/StringExtensions.cs +++ b/src/Meilisearch/Extensions/StringExtensions.cs @@ -76,5 +76,51 @@ internal static IEnumerable GetCsvChunks(this string csvString, int chun } } } + + /// + /// Returns chunks from a NDJSON string. + /// + /// The NDJSON string to split. + /// Size of the chunks. + /// List of NDJSON string. + /// Thrown if ndjsonString is null. + /// Throw if chunkSize is lower than 1. + internal static IEnumerable GetNdjsonChunks(this string ndjsonString, int chunkSize) + { + if (string.IsNullOrWhiteSpace(ndjsonString)) + { + throw new ArgumentNullException(nameof(ndjsonString)); + } + + if (chunkSize < 1) + { + throw new ArgumentException("chunkSize value must be greater than 0", nameof(chunkSize)); + } + + using (var sr = new StringReader(ndjsonString)) + { + var sb = new StringBuilder(); + var line = ""; + var lineNumber = 0; + while ((line = sr.ReadLine()) != null) + { + sb.AppendLine(line); + ++lineNumber; + + if (lineNumber % chunkSize == 0) + { + // We return our chunk, we clear our string builder + yield return sb.ToString(); + sb.Clear(); + } + } + + // After the last line we check if we have something to send + if (lineNumber % chunkSize != 0) + { + yield return sb.ToString(); + } + } + } } } diff --git a/src/Meilisearch/Index.Documents.cs b/src/Meilisearch/Index.Documents.cs index 93d5567a..d7031334 100644 --- a/src/Meilisearch/Index.Documents.cs +++ b/src/Meilisearch/Index.Documents.cs @@ -83,6 +83,29 @@ public async Task AddDocumentsCsvAsync(string documents, string primar .ConfigureAwait(false); } + /// + /// Add documents from NDJSON string. + /// + /// Documents to add as NDJSON string. + /// Primary key for the documents. + /// The cancellation token for this call. + /// Returns the task info. + public async Task AddDocumentsNdjsonAsync(string documents, string primaryKey = default, + CancellationToken cancellationToken = default) + { + var uri = $"indexes/{Uid}/documents"; + + if (primaryKey != default) + { + uri = $"{uri}?{new { primaryKey = primaryKey }.ToQueryString()}"; + } + + var content = new StringContent(documents, Encoding.UTF8, ContentType.Ndjson); + var responseMessage = await _http.PostAsync(uri, content, cancellationToken).ConfigureAwait(false); + return await responseMessage.Content.ReadFromJsonAsync(cancellationToken: cancellationToken) + .ConfigureAwait(false); + } + /// /// Adds documents in batches with size specified with . /// @@ -107,7 +130,7 @@ public async Task> AddDocumentsInBatchesAsync(IEnumerab /// /// Adds documents from CSV string in batches with size specified with . /// - /// Documents to add. + /// Documents to add as CSV string. /// Size of documents batches while adding them. /// Primary key for the documents. /// The cancellation token for this call. @@ -124,6 +147,26 @@ public async Task> AddDocumentsCsvInBatchesAsync(string do return tasks; } + /// + /// Adds documents from NDJSON string in batches with size specified with . + /// + /// Documents to add as NDJSON string. + /// Size of documents batches while adding them. + /// Primary key for the documents. + /// The cancellation token for this call. + /// Returns the task list. + public async Task> AddDocumentsNdjsonInBatchesAsync(string documents, + int batchSize = 1000, string primaryKey = default, CancellationToken cancellationToken = default) + { + var tasks = new List(); + foreach (var chunk in documents.GetNdjsonChunks(batchSize)) + { + tasks.Add(await AddDocumentsNdjsonAsync(chunk, primaryKey, cancellationToken).ConfigureAwait(false)); + } + + return tasks; + } + /// /// Update documents. /// @@ -195,6 +238,29 @@ public async Task UpdateDocumentsCsvAsync(string documents, string pri .ConfigureAwait(false); } + /// + /// Update documents from NDJSON string. + /// + /// Documents to add as NDJSON string. + /// Primary key for the documents. + /// The cancellation token for this call. + /// Returns the task info. + public async Task UpdateDocumentsNdjsonAsync(string documents, string primaryKey = default, + CancellationToken cancellationToken = default) + { + var uri = $"indexes/{Uid}/documents"; + + if (primaryKey != default) + { + uri = $"{uri}?{new { primaryKey = primaryKey }.ToQueryString()}"; + } + + var content = new StringContent(documents, Encoding.UTF8, ContentType.Ndjson); + var responseMessage = await _http.PutAsync(uri, content, cancellationToken).ConfigureAwait(false); + return await responseMessage.Content.ReadFromJsonAsync(cancellationToken: cancellationToken) + .ConfigureAwait(false); + } + /// /// Updates documents in batches with size specified with . /// @@ -236,6 +302,26 @@ public async Task> UpdateDocumentsCsvInBatchesAsync(string return tasks; } + /// + /// Updates documents as NDJSON string in batches with size specified with . + /// + /// Documents to update from NDJSON string. + /// Size of documents batches while updating them. + /// Primary key for the documents. + /// The cancellation token for this call. + /// Returns the task list. + public async Task> UpdateDocumentsNdjsonInBatchesAsync(string documents, + int batchSize = 1000, string primaryKey = default, CancellationToken cancellationToken = default) + { + var tasks = new List(); + foreach (var chunk in documents.GetNdjsonChunks(batchSize)) + { + tasks.Add(await UpdateDocumentsNdjsonAsync(chunk, primaryKey, cancellationToken).ConfigureAwait(false)); + } + + return tasks; + } + /// /// Get document by its ID. /// diff --git a/tests/Meilisearch.Tests/Datasets.cs b/tests/Meilisearch.Tests/Datasets.cs index 70891ac9..c4fb1f8a 100644 --- a/tests/Meilisearch.Tests/Datasets.cs +++ b/tests/Meilisearch.Tests/Datasets.cs @@ -10,6 +10,7 @@ internal static class Datasets private static readonly string BasePath = Path.Combine(Directory.GetCurrentDirectory(), "Datasets"); public static readonly string SmallMoviesJson = Path.Combine(BasePath, "small_movies.json"); public static readonly string SongsCsv = Path.Combine(BasePath, "songs.csv"); + public static readonly string SongsNdjson = Path.Combine(BasePath, "songs.ndjson"); } public class DatasetSmallMovie diff --git a/tests/Meilisearch.Tests/Datasets/songs.ndjson b/tests/Meilisearch.Tests/Datasets/songs.ndjson new file mode 100644 index 00000000..9a0bcd9d --- /dev/null +++ b/tests/Meilisearch.Tests/Datasets/songs.ndjson @@ -0,0 +1,225 @@ +{"id":"412559401","title":"BEETHOVEN","album":"Trousers Are For Everybody","artist":"Dylan Sheridan","genre":"Classical","country":"US","released":"2012-07-01","duration":"1:23","released-timestamp":1341100800,"duration-float":1.23} +{"id":"1126973500","title":"Forever Love (Original Vocal)","album":"Forever Love","artist":"Glenn Underground","genre":"Funk / Soul","country":"US","released":"2016-05-30","duration":"8:47","released-timestamp":1464566400,"duration-float":8.47} +{"id":"388897008","title":"Summer Rain (Extended Version)","album":"B-Sides And 12\" Mixes 1984-1990, Volume 2","artist":"Alphaville","genre":"Electronic","country":"","released":"","duration":""} +{"id":"1503315485","title":"Hernando's Hideaway","album":"Una Musica Per Essere Felici","artist":"Franck Pourcel","genre":"Classical","country":"Italy","released":"","duration":""} +{"id":"265573703","title":"Commit Yourself (iLL & Flanger Mix)","album":"Commit Yourself","artist":"King Electric","genre":"Pop","country":"Austria","released":"2011","duration":"6:03","released-timestamp":1293840000,"duration-float":6.03} +{"id":"304332404","title":"Futile Existence","album":"Bush Is Killing Our Liberty","artist":"Contempt For Humanity","genre":"Rock","country":"US","released":"","duration":""} +{"id":"84180607","title":"Bachatel","album":"GX1","artist":"Rick van der Linden","genre":"Pop","country":"Netherlands","released":"1977","duration":"7:52","released-timestamp":220924800,"duration-float":7.52} +{"id":"127324609","title":"Vogeltjesdans","album":"Hakkuh Op Z'n Hollands 3","artist":"Various","genre":"Electronic","country":"Netherlands","released":"","duration":"3:46","duration-float":3.46} +{"id":"711359002","title":"OMG - I'm Being Killed (Extended Version)","album":"OMG - I'm Being Killed","artist":"John Doe Experience","genre":"Electronic","country":"Germany","released":"2015-04-30","duration":"20:26","released-timestamp":1430352000,"duration-float":20.26} +{"id":"1375757004","title":"Center Point Road","album":"Center Point Road","artist":"Thomas Rhett","genre":"Folk, World, & Country","country":"US","released":"2019","duration":"3:37","released-timestamp":1546300800,"duration-float":3.37} +{"id":"677876304","title":"Glorious Grace","album":"Michael W. Smith 2","artist":"Michael W. Smith","genre":"Folk, World, & Country","country":"US","released":"1984","duration":"3:26","released-timestamp":441763200,"duration-float":3.26} +{"id":"665138701","title":"Come Worship The Lord (Psalm 95)","album":"Signatures","artist":"John Michael Talbot","genre":"Folk, World, & Country","country":"US","released":"2003","duration":"4:14","released-timestamp":1041379200,"duration-float":4.14} +{"id":"1585792311","title":"Can't Get Used To Losing You","album":"I Just Can't Stop It","artist":"The Beat (2)","genre":"Rock","country":"US","released":"1980","duration":"3:05","released-timestamp":315532800,"duration-float":3.05} +{"id":"327299911","title":"So Tired","album":"The Soundhouse Tapes / Throwing Shapes","artist":"Stratus (5)","genre":"Rock","country":"Italy","released":"1993","duration":"4:45","released-timestamp":725846400,"duration-float":4.45} +{"id":"33952003","title":"Appreciate (Original)","album":"It's A Love Thing","artist":"Pete Rock","genre":"Hip Hop","country":"France","released":"2004","duration":"","released-timestamp":1072915200} +{"id":"1534599901","title":"Springwater","album":"Weekend Room","artist":"Ryan Massad","genre":"Pop","country":"US","released":"2020-03-13","duration":"","released-timestamp":1584057600} +{"id":"1075328001","title":"Altered State","album":"Arising From The Jungle","artist":"Sepultura","genre":"Rock","country":"Brazil","released":"","duration":""} +{"id":"1346398611","title":"Historia De Un Amor","album":"El Concierto","artist":"Luis Miguel","genre":"Pop","country":"","released":"1995","duration":"3:52","released-timestamp":788918400,"duration-float":3.52} +{"id":"1045695601","title":"Just For One Day (Heroes)(Club Mix)","album":"Promo Only Mainstream Club: January 04","artist":"Various","genre":"Electronic","country":"Canada","released":"2004","duration":"6:37","released-timestamp":1072915200,"duration-float":6.37} +{"id":"116155000","title":"Zhe Nhir Is A One Trick Pony","album":"Zhe's Anatomy","artist":"Zhe Nhir","genre":"Electronic","country":"Australia","released":"2007-11-00","duration":"1:18","released-timestamp":1193875200,"duration-float":1.18} +{"id":"211961501","title":"Feed The Horse","album":"We Are Above You","artist":"Clouds (3)","genre":"Rock","country":"US","released":"2008","duration":"","released-timestamp":1199145600} +{"id":"70764404","title":"Forget You","album":"This Is Pilita","artist":"Pilita","genre":"Pop","country":"Australia","released":"","duration":"2:13","duration-float":2.13} +{"id":"243198559","title":"Концерт «Live '97» The Best","album":"Мастер","artist":"Мастер","genre":"Rock","country":"Russia","released":"2002","duration":"","released-timestamp":1009843200} +{"id":"26813016","title":"God Forgive Me","album":"Absolute Music 31","artist":"Various","genre":"Pop","country":"Norway","released":"2000","duration":"3:35","released-timestamp":946684800,"duration-float":3.35} +{"id":"760709600","title":"En Saluant Marquise","album":"Des Vacances A Victor","artist":"Michel Fontayne","genre":"Folk, World, & Country","country":"France","released":"","duration":""} +{"id":"1255406509","title":"Act 1. Part 2, Scene 7. Zdravstvuy, soldat!","album":"Semyon Kotko","artist":"Valery Gergiev","genre":"Classical","country":"Europe","released":"2000","duration":"4:59","released-timestamp":946684800,"duration-float":4.59} +{"id":"585222400","title":"Vaisnava Bhajan","album":"Saradamani","artist":"Sukhvinder Singh Namdhari","genre":"Folk, World, & Country","country":"US","released":"1992","duration":"9:08","released-timestamp":694224000,"duration-float":9.08} +{"id":"1329786615","title":"Mon Piano Romantique","album":"Best Selection","artist":"Pierre Porte","genre":"Classical","country":"Japan","released":"1986","duration":"","released-timestamp":504921600} +{"id":"213355407","title":"Truth'll Set You Free","album":"Verve Today 2009","artist":"Various","genre":"Jazz","country":"Europe","released":"2009","duration":"4:58","released-timestamp":1230768000,"duration-float":4.58} +{"id":"1455632303","title":"Carry Your Own Load","album":"A Gasssss","artist":"Junior Walker & The All Stars","genre":"Funk / Soul","country":"Australia","released":"1970","duration":"2:58","released-timestamp":0,"duration-float":2.58} +{"id":"1176330619","title":"We Are Good","album":"Monarchs","artist":"Jad Fair","genre":"Rock","country":"US","released":"1984","duration":"","released-timestamp":441763200} +{"id":"219469000","title":"Contenders","album":"Pleasure One","artist":"Heaven 17","genre":"Electronic","country":"Canada","released":"1986","duration":"5:24","released-timestamp":504921600,"duration-float":5.24} +{"id":"808098401","title":"Hardway","album":"One For The Road","artist":"The Kinks","genre":"Rock","country":"Europe","released":"1988","duration":"2:42","released-timestamp":567993600,"duration-float":2.42} +{"id":"5248505","title":"Body 2 Body","album":"Chemistry Y2K#1","artist":"DJ Marcello","genre":"Electronic","country":"Netherlands","released":"2000","duration":"4:44","released-timestamp":946684800,"duration-float":4.44} +{"id":"96567104","title":"My Love Is Crazy 4 You","album":"Super Eurobeat Vol. 102","artist":"Various","genre":"Electronic","country":"Japan","released":"2000-01-26","duration":"4:06","released-timestamp":948844800,"duration-float":4.06} +{"id":"405504000","title":"Le Bande Di Lanciane","album":"Canti Degli Abruzzi","artist":"Various","genre":"Folk, World, & Country","country":"Italy","released":"1965-09-27","duration":"","released-timestamp":-134524800} +{"id":"1235243615","title":"The Hawaiian Cowboy","album":"Paving The Highway With Tears: The Very Best Of The Singing Ranger","artist":"Hank Snow","genre":"Folk, World, & Country","country":"UK","released":"2008","duration":"","released-timestamp":1199145600} +{"id":"1405382801","title":"Turnpike Ike","album":"Port Of Miami 2","artist":"Rick Ross","genre":"Hip Hop","country":"Europe","released":"2019-08-09","duration":"4:20","released-timestamp":1565308800,"duration-float":4.2} +{"id":"1402528807","title":"Night In The City","album":"Persona Non Grata","artist":"Tilidin","genre":"Rock","country":"Germany","released":"2019","duration":"","released-timestamp":1546300800} +{"id":"897569209","title":"Girlfriend","album":"ME-CD Nr. 0916","artist":"Various","genre":"Folk, World, & Country","country":"Germany","released":"2016","duration":"3:46","released-timestamp":1451606400,"duration-float":3.46} +{"id":"1087796003","title":"Almost Human","album":"V 5ive","artist":"Symbolic (8)","genre":"Rock","country":"US","released":"2016-12-06","duration":"","released-timestamp":1480982400} +{"id":"293511812","title":"Demos # 2 - June / December 1981","album":"How Nebraska Was Born... (The Definitive \"Nebraska\" Outtakes)","artist":"Bruce Springsteen","genre":"Rock","country":"Europe","released":"2005-01-01","duration":"","released-timestamp":1104537600} +{"id":"857390100","title":"Martyr The Dead","album":"Napalm Orgy","artist":"Artillery Swarm","genre":"Rock","country":"US","released":"2010","duration":"02:10","released-timestamp":1262304000,"duration-float":2.1} +{"id":"33071822","title":"Jealousy (Is A M.F.) (Neophyte Rmx)","album":"Thunderdome - Hardcore Rules The World","artist":"Various","genre":"Electronic","country":"Netherlands","released":"2002-10-00","duration":"4:24","released-timestamp":1033430400,"duration-float":4.24} +{"id":"1496216507","title":"Sakat","album":"Rézon@nces 4","artist":"Various","genre":"Folk, World, & Country","country":"France","released":"2007","duration":"5:22","released-timestamp":1167609600,"duration-float":5.22} +{"id":"1539958702","title":"Ich weiss nicht","album":"Breitschuh Singt Brel - Bei Den Leuten Da","artist":"Eckart Breitschuh","genre":"Pop","country":"Germany","released":"2016","duration":"","released-timestamp":1451606400} +{"id":"1262554315","title":"Noah And The Mighty Ark","album":"Back In The Good Ole Days","artist":"The Masters Family (2)","genre":"Folk, World, & Country","country":"Germany","released":"2006","duration":"","released-timestamp":1136073600} +{"id":"758864008","title":"Butterfly","album":"Jean Claude Pascal","artist":"Jean-Claude Pascal","genre":"Pop","country":"Germany","released":"1979","duration":"2:53","released-timestamp":283996800,"duration-float":2.5300000000000004} +{"id":"777552505","title":"Cloudy Sky Blues","album":"Snake Hip Shakes","artist":"Snake Hip Shakes","genre":"Rock","country":"Japan","released":"2000-07-26","duration":"","released-timestamp":964569600} +{"id":"1206566003","title":"Children Of The Damned","album":"Somewhere In Chicago","artist":"Iron Maiden","genre":"Rock","country":"","released":"2012-11-00","duration":"","released-timestamp":1351728000} +{"id":"833158506","title":"After Midnight","album":"Rock After Midnight - The Essential Rock Ballads","artist":"Various","genre":"Rock","country":"Greece","released":"1993","duration":"","released-timestamp":725846400} +{"id":"699655401","title":"Tomorrow's Up For Sale","album":"Easy If You Try / Tomorrow's Up For Sale","artist":"Magna Carta","genre":"Folk, World, & Country","country":"Spain","released":"1977","duration":"2:55","released-timestamp":220924800,"duration-float":2.55} +{"id":"754418509","title":"Equador","album":"Mtv Greatest Hits 97","artist":"Various","genre":"Pop","country":"Lithuania","released":"1997","duration":"","released-timestamp":852076800} +{"id":"74347902","title":"Trauma","album":"Undergrowth Music Vol. 1","artist":"Starzwah","genre":"Electronic","country":"UK","released":"2006","duration":"4:03","released-timestamp":1136073600,"duration-float":4.03} +{"id":"637848209","title":"Samba 73","album":"Eleven Steps","artist":"Karel Krautgartner","genre":"Stage & Screen","country":"Italy","released":"1977","duration":"","released-timestamp":220924800} +{"id":"1314531709","title":"Dos Hombres Un Destino","album":"Simplemente","artist":"Daniel Luna","genre":"Latin","country":"US","released":"2003","duration":"4:16","released-timestamp":1041379200,"duration-float":4.16} +{"id":"1364346222","title":"A Medias De La Noche","album":"Anatomia Musical de Victor Yturbe Piruli","artist":"Victor Yturbe \"Pirulí\"","genre":"Latin","country":"Mexico","released":"1974","duration":"","released-timestamp":126230400} +{"id":"102680105","title":"In The Mood","album":"Rush","artist":"Rush","genre":"Rock","country":"UK","released":"1974","duration":"3:36","released-timestamp":126230400,"duration-float":3.36} +{"id":"684082515","title":"Trying To Lose The Blues","album":"Joe Liggins And The Honeydrippers","artist":"Joe Liggins","genre":"Blues","country":"UK","released":"1989","duration":"","released-timestamp":599616000} +{"id":"481551614","title":"Congratulations, You Have Just Met The Famous BSSR Nazikillers","album":"Noise In Opposition","artist":"Various","genre":"Electronic","country":"","released":"2013-07-29","duration":"0:26","released-timestamp":1375056000,"duration-float":0.26} +{"id":"756110314","title":"Music Video","album":"約束","artist":"Tokyo Girls' Style","genre":"Pop","country":"Japan","released":"2013-01-30","duration":"","released-timestamp":1359504000} +{"id":"1389424609","title":"A Fellow Needs A Girl","album":"Young At Heart: Essential Gold","artist":"Frank Sinatra","genre":"Pop","country":"Germany","released":"2005","duration":"","released-timestamp":1104537600} +{"id":"232149106","title":"White Rose","album":"Old Paint","artist":"Freakwater","genre":"Rock","country":"Germany","released":"1995","duration":"4:24","released-timestamp":788918400,"duration-float":4.24} +{"id":"594530202","title":"It Never Dies","album":"True Carnage","artist":"Six Feet Under","genre":"Rock","country":"Poland","released":"2001","duration":"2:41","released-timestamp":978307200,"duration-float":2.41} +{"id":"1167925804","title":"Spot Reklamowy PLAYBOYA","album":"Sexuality","artist":"Edyta Górniak","genre":"Pop","country":"Poland","released":"2006","duration":"0:15","released-timestamp":1136073600,"duration-float":0.15} +{"id":"878008408","title":"Big 10 1/2","album":"Paradise Don't Come Cheap","artist":"New Kingdom","genre":"Hip Hop","country":"Canada","released":"1996","duration":"","released-timestamp":820454400} +{"id":"3822102","title":"Dualis","album":"Hacker","artist":"Anthony Rother","genre":"Electronic","country":"Germany","released":"2002","duration":"10:22","released-timestamp":1009843200,"duration-float":10.22} +{"id":"581262505","title":"Fra \" Nordland Trompet\"","album":"Mit Navn Er Petter Dass, Som Boer Ved Verdens Ende","artist":"Ola Bremnes","genre":"Folk, World, & Country","country":"Norway","released":"1984","duration":"","released-timestamp":441763200} +{"id":"1399775330","title":"Everything Happens To Me","album":"The Best of CHET BAKER SINGS","artist":"Chet Baker","genre":"Jazz","country":"Europe","released":"2013","duration":"5:04","released-timestamp":1356998400,"duration-float":5.04} +{"id":"270250900","title":"Dark Lady","album":"In Trance","artist":"Scorpions","genre":"Rock","country":"Japan","released":"1989-06-21","duration":"3:30","released-timestamp":614390400,"duration-float":3.3} +{"id":"877770702","title":"Unknown Tongues","album":"Aldebaran","artist":"Natural Snow Buildings","genre":"Electronic","country":"US","released":"2016-07-14","duration":"2:04","released-timestamp":1468454400,"duration-float":2.04} +{"id":"822778300","title":"You Are The Quarry","album":"You Are The Quarry + Ringleader Of The Tormentors","artist":"Morrissey","genre":"Rock","country":"Indonesia","released":"2010","duration":"","released-timestamp":1262304000} +{"id":"834409311","title":"Permis de Détruire","album":"Permis de détruire","artist":"Dezes","genre":"Rock","country":"France","released":"2013","duration":"","released-timestamp":1356998400} +{"id":"695586101","title":"En El Barranco Del Lobo","album":"La Guerra Civil Española","artist":"Francisco Curto","genre":"Folk, World, & Country","country":"Spain","released":"1976","duration":"","released-timestamp":189302400} +{"id":"894705402","title":"Get Down On It","album":"The Greatest Funk Hits Of All Time","artist":"Various","genre":"Funk / Soul","country":"US","released":"2006","duration":"","released-timestamp":1136073600} +{"id":"1401036902","title":"Good Flood","album":"The Big Bam Theory","artist":"Various","genre":"Electronic","country":"Germany","released":"2014-12-08","duration":"9:14","released-timestamp":1417996800,"duration-float":9.14} +{"id":"244273802","title":"Lionheart","album":"Kerosene","artist":"Popealopes","genre":"Rock","country":"US","released":"1990","duration":"4:47","released-timestamp":631152000,"duration-float":4.47} +{"id":"1358842201","title":"D'Indianer-Zaubermedizin","album":"De Velochlauer Chunnt Is Chefi / D'Indianer-Zaubermedizin","artist":"Paul Bühlmann","genre":"Children's","country":"Switzerland","released":"2003","duration":"","released-timestamp":1041379200} +{"id":"1119781120","title":"When Will I See You Again","album":"The 70s Pop Annual","artist":"Various","genre":"Pop","country":"UK","released":"2017-11-17","duration":"","released-timestamp":1510876800} +{"id":"1542573517","title":"Chart Breakers","album":"Future Hits - 182","artist":"Various","genre":"Stage & Screen","country":"UK","released":"2000","duration":"","released-timestamp":946684800} +{"id":"1260328305","title":"Lifetime When Right (Original Mix)","album":"Best Of Uplifting Vocal Trance","artist":"Various","genre":"Electronic","country":"Netherlands","released":"2014-09-08","duration":"7:13","released-timestamp":1410134400,"duration-float":7.13} +{"id":"814855003","title":"Come Gira","album":"Bringing Home The Bacon","artist":"Il Kasato","genre":"Hip Hop","country":"Italy","released":"2013","duration":"","released-timestamp":1356998400} +{"id":"1464533108","title":"Baby Come Back","album":"On The Top 15 International Gstanzerln Of Bavarian City Nights","artist":"Various","genre":"Rock","country":"Germany","released":"1992","duration":"3:00","released-timestamp":694224000,"duration-float":3} +{"id":"1146186901","title":"Quartet In D Major, K. 575","album":"Quartet In D Major, K. 199 / Quartet In D Major, K. 575","artist":"Barchet-Quartett","genre":"Classical","country":"US","released":"1955","duration":"21:50","released-timestamp":-473385600,"duration-float":21.5} +{"id":"1337150303","title":"Ham Tum Se Juda Ho Ke","album":"Ek Sapera Ek Lutera","artist":"Asad Bhopali","genre":"Stage & Screen","country":"India","released":"1965","duration":"","released-timestamp":-157766400} +{"id":"166396600","title":"Oh No (Remix - Radio)","album":"Oh No (Remix)","artist":"Noreaga","genre":"Hip Hop","country":"US","released":"1999","duration":"","released-timestamp":915148800} +{"id":"37035104","title":"Afterglow (Reprise)","album":"Neverland","artist":"The Mission","genre":"Rock","country":"Europe","released":"1995","duration":"7:50","released-timestamp":788918400,"duration-float":7.5} +{"id":"1439805607","title":"Митро Ле, Митро","album":"Копривщица '71 - Втори Национален Фолклорен Събор","artist":"Various","genre":"Folk, World, & Country","country":"Bulgaria","released":"","duration":""} +{"id":"561094816","title":"瑪莉亞","album":"尤雅『精選集【Vol 1】』","artist":"You Ya","genre":"Folk, World, & Country","country":"Taiwan","released":"2003","duration":"","released-timestamp":1041379200} +{"id":"724845003","title":"Belial","album":"Of Ash And Dying Light​.​.​.","artist":"Altars Of Grief","genre":"Rock","country":"","released":"2015-05-29","duration":"8:36","released-timestamp":1432857600,"duration-float":8.36} +{"id":"1142024102","title":"Laisse Un Peu D'amour","album":"Mon Anneau D'or","artist":"Johnny Hallyday","genre":"Pop","country":"France","released":"1965-10-22","duration":"","released-timestamp":-132364800} +{"id":"1327140807","title":"Untitled","album":"Secrets Of Success - Relationships Happiness Wealth","artist":"Michael Domeyko Rowland","genre":"Non-Music","country":"Australia","released":"1992","duration":"","released-timestamp":694224000} +{"id":"323483708","title":"Firewater Friends","album":"Brotherly Love","artist":"Dean Dillon","genre":"Folk, World, & Country","country":"US","released":"1982","duration":"","released-timestamp":378691200} +{"id":"816562410","title":"Bonus Tracks","album":"Brothers","artist":"Francis Lockwood","genre":"Jazz","country":"France","released":"2009","duration":"","released-timestamp":1230768000} +{"id":"1122690201","title":"武田二十四将","album":"新府城 / 武田二十四将","artist":"Michiya Mihashi","genre":"Folk, World, & Country","country":"Japan","released":"1973","duration":"2:57","released-timestamp":94694400,"duration-float":2.57} +{"id":"411903408","title":"De Un Mundo Raro","album":"A México","artist":"Julio Iglesias","genre":"Latin","country":"Spain","released":"","duration":""} +{"id":"1079262602","title":"Under My Thumb","album":"Milestones","artist":"The Rolling Stones","genre":"Rock","country":"New Zealand","released":"","duration":""} +{"id":"946691100","title":"Burning Swamp Witch","album":"Split","artist":"Los Tentakills","genre":"Rock","country":"","released":"","duration":""} +{"id":"1339673103","title":"Soldier In The Rain","album":"Strike Up The Band","artist":"Quincy Jones","genre":"Stage & Screen","country":"Europe","released":"","duration":"3:09","duration-float":3.09} +{"id":"1574566100","title":"Non Credere","album":"Non Credere / La Vigna","artist":"Loredana (4)","genre":"Pop","country":"Italy","released":"","duration":""} +{"id":"959130025","title":"Runaway (MTV Unplugged Version)","album":"The Best Ever Acoustic","artist":"Various","genre":"Rock","country":"UK","released":"2016","duration":"","released-timestamp":1451606400} +{"id":"937367904","title":"The Lazy Song","album":"Everyone's Talking About","artist":"Bruno Mars","genre":"Pop","country":"Europe","released":"2010","duration":"3:15","released-timestamp":1262304000,"duration-float":3.15} +{"id":"1188087908","title":"Sentimiento","album":"Nos Sobra Voluntad","artist":"Primera Clase (2)","genre":"Folk, World, & Country","country":"Cuba","released":"1998","duration":"4:31","released-timestamp":883612800,"duration-float":4.31} +{"id":"1188327015","title":"Love Slipped Away","album":"It's A Deep Soul Thing Vol. 7","artist":"Various","genre":"Funk / Soul","country":"Canada","released":"","duration":"2:43","duration-float":2.43} +{"id":"249536102","title":"Bigger Boys And Stolen Sweethearts (File Vocal Up)","album":"Bigger Better / I Bet You...","artist":"Arctic Monkeys","genre":"Rock","country":"UK","released":"2005-08-10","duration":"2:56","released-timestamp":1123632000,"duration-float":2.56} +{"id":"1270413834","title":"Solen Er Så Rød Mor","album":"Storyteller # 1","artist":"Lars Lilholt","genre":"Folk, World, & Country","country":"Denmark","released":"2006","duration":"","released-timestamp":1136073600} +{"id":"151417203","title":"Simphonie. Air: \"Vole, Vole, Dit-Elle Avec Amour\"","album":"Cantates","artist":"William Christie","genre":"Classical","country":"France","released":"1990","duration":"1:16","released-timestamp":631152000,"duration-float":1.16} +{"id":"1182878701","title":"Вариации На Тему Паганини","album":"Фортепианный Дуэт","artist":"Bruno Lukk","genre":"Classical","country":"USSR","released":"1964","duration":"","released-timestamp":-189388800} +{"id":"1259266002","title":"Zofinger-Marsch","album":"Schweizer Marschmusik","artist":"Das Große Blasorchester","genre":"Brass & Military","country":"Switzerland","released":"","duration":""} +{"id":"1071388008","title":"Calvary","album":"There's A Song","artist":"Elodie Preston Williams","genre":"Folk, World, & Country","country":"US","released":"1976","duration":"","released-timestamp":189302400} +{"id":"1291164804","title":"They Came From The South","album":"Fifty Fifty - 50/50 (Originalmusikken Fra Spillefilmen)","artist":"Various","genre":"Stage & Screen","country":"Norway","released":"1982","duration":"2:10","released-timestamp":378691200,"duration-float":2.1} +{"id":"607688802","title":"Mr. Telephone Man","album":"All The Number Ones: Together & Solo","artist":"New Edition","genre":"Pop","country":"US","released":"2000","duration":"4:01","released-timestamp":946684800,"duration-float":4.01} +{"id":"1045536009","title":"Mon Die, Rete Bou Nous","album":"Pierre Et Jean","artist":"Pierre Et Jean","genre":"Folk, World, & Country","country":"France","released":"","duration":"2:24","duration-float":2.24} +{"id":"1348271309","title":"Two Beds And A Coffee Machine","album":"Affirmation","artist":"Savage Garden","genre":"Rock","country":"Asia","released":"1999","duration":"3:27","released-timestamp":915148800,"duration-float":3.27} +{"id":"466477105","title":"Штирлиц","album":"Программа Время","artist":"Ландыши","genre":"Rock","country":"Russia","released":"2004-04-00","duration":"","released-timestamp":1080777600} +{"id":"1014320002","title":"Sheen Gun","album":"The Mechanical Abrasions Of (Volume One)","artist":"Ashtray Navigations","genre":"Rock","country":"UK","released":"2016","duration":"9:24","released-timestamp":1451606400,"duration-float":9.24} +{"id":"1265840304","title":"Big Talk No Walk","album":"My Turn","artist":"Estasia (2)","genre":"Electronic","country":"Belgium","released":"2018-10-13","duration":"3:53","released-timestamp":1539388800,"duration-float":3.5300000000000004} +{"id":"343536700","title":"Puttin On The Rtiz","album":"Unique Percussion","artist":"Terry Snyder And The All Stars","genre":"Jazz","country":"US","released":"1961","duration":"","released-timestamp":-283996800} +{"id":"52269800","title":"Raza Park (Long Version)","album":"Raza Park","artist":"Latino Velvet","genre":"Hip Hop","country":"US","released":"1998","duration":"","released-timestamp":883612800} +{"id":"1249222630","title":"I'm Rowed Out","album":"Mod","artist":"Various","genre":"Pop","country":"UK","released":"2018-08-17","duration":"","released-timestamp":1534464000} +{"id":"608704413","title":"Offenbach: The Grand Duchess","album":"Music Boxes, Carousels And Old Hand Organ","artist":"Various","genre":"Folk, World, & Country","country":"US","released":"","duration":""} +{"id":"235206307","title":"Blast In Oklahoma","album":"Perkeleen Punkit - Finnhits Vol.2 (+Visitor From Estonia)","artist":"Various","genre":"Rock","country":"Finland","released":"","duration":""} +{"id":"1609319718","title":"Naše Noči","album":"29. Festival Melodije Morja In Sonca","artist":"Various","genre":"Pop","country":"Slovenia","released":"2006","duration":"2:43","released-timestamp":1136073600,"duration-float":2.43} +{"id":"23570027","title":"Sounds Reason","album":"Gathering 2002 / Amphibians","artist":"Various","genre":"Electronic","country":"Japan","released":"2003","duration":"8:48","released-timestamp":1041379200,"duration-float":8.48} +{"id":"1302391615","title":"Thing About Your Troubles","album":"For The Love Of Harry - Everybody Sings Nilsson","artist":"Various","genre":"Stage & Screen","country":"US","released":"1995","duration":"2:42","released-timestamp":788918400,"duration-float":2.42} +{"id":"375518001","title":"Your Course","album":"All The Monsters Are Small And Soft And Scared","artist":"Emmy Moll","genre":"Rock","country":"Europe","released":"2008","duration":"4:41","released-timestamp":1199145600,"duration-float":4.41} +{"id":"891905815","title":"Don't Let It End","album":"Greatest Hits","artist":"Styx","genre":"Rock","country":"US","released":"1995","duration":"4:54","released-timestamp":788918400,"duration-float":4.54} +{"id":"1102298308","title":"Iz Naših Krajev (Polka)","album":"V Deželi Glasbe In Petja","artist":"Ansambel Bratov Avsenik","genre":"Folk, World, & Country","country":"Yugoslavia","released":"1975","duration":"","released-timestamp":157766400} +{"id":"991734603","title":"Blue Suede Shoes","album":"The Great Performances (Volume 2 - The Man And The Music)","artist":"Elvis Presley","genre":"Folk, World, & Country","country":"US","released":"1990","duration":"","released-timestamp":631152000} +{"id":"754902205","title":"Call Me (Richard F Mix)","album":"Call Me","artist":"Shawnee Taylor","genre":"Electronic","country":"UK","released":"2006","duration":"6:45","released-timestamp":1136073600,"duration-float":6.45} +{"id":"948252600","title":"Kiradji Mladi Jabandji","album":"Synthesis & Naum Petreski","artist":"Наум Петрески","genre":"Folk, World, & Country","country":"Macedonia","released":"2014","duration":"5:35","released-timestamp":1388534400,"duration-float":5.35} +{"id":"237640501","title":"Medley","album":"I Say Yeah","artist":"Dream Street","genre":"Pop","country":"US","released":"2001","duration":"","released-timestamp":978307200} +{"id":"872684707","title":"Delaunay's Dilemma","album":"Django","artist":"The Modern Jazz Quartet","genre":"Jazz","country":"Japan","released":"1994","duration":"4:01","released-timestamp":757382400,"duration-float":4.01} +{"id":"488773613","title":"Clifton","album":"Let's Get Rid Of L.A.","artist":"Various","genre":"Rock","country":"US","released":"2002","duration":"","released-timestamp":1009843200} +{"id":"2338904","title":"Mystery Of Freewill","album":"Zero Point","artist":"Robert Rich","genre":"Electronic","country":"US","released":"2001","duration":"6:08","released-timestamp":978307200,"duration-float":6.08} +{"id":"20026605","title":"Truck Volume (Turn It Up To 10)","album":"Cocoon Compilation C","artist":"Various","genre":"Electronic","country":"Germany","released":"2002-09-02","duration":"6:36","released-timestamp":1030924800,"duration-float":6.36} +{"id":"160281806","title":"Feelings","album":"Breaker","artist":"Accept","genre":"Rock","country":"US","released":"1981","duration":"4:48","released-timestamp":347155200,"duration-float":4.48} +{"id":"783020114","title":"Middle East","album":"Long Live The Past The Demo Collection","artist":"Various","genre":"Rock","country":"Greece","released":"2015-12-00","duration":"4:54","released-timestamp":1448928000,"duration-float":4.54} +{"id":"737909403","title":"Il Silenzio","album":"Ohrwürmer (Instrumental Hits)","artist":"Estudio Miami Ritmo","genre":"Pop","country":"Germany","released":"2006","duration":"","released-timestamp":1136073600} +{"id":"304134603","title":"Burn The Banks","album":"Information Is Power","artist":"LUVDUMP","genre":"Rock","country":"UK","released":"2010-09-21","duration":"3:15","released-timestamp":1285027200,"duration-float":3.15} +{"id":"945334113","title":"Tonight","album":"The Original Johnny Mathis","artist":"Johnny Mathis","genre":"Pop","country":"Europe","released":"2009","duration":"","released-timestamp":1230768000} +{"id":"897737807","title":"Soulful Ballad","album":"In Movement","artist":"Matthew Garrison","genre":"Jazz","country":"US","released":"2016","duration":"4:22","released-timestamp":1451606400,"duration-float":4.22} +{"id":"419836808","title":"Oon Sun Mies","album":"Halleluja","artist":"Matti Esko","genre":"Pop","country":"Finland","released":"2011-01-13","duration":"4:04","released-timestamp":1294876800,"duration-float":4.04} +{"id":"262037903","title":"Soul In Isolation","album":"Strange Times","artist":"The Chameleons","genre":"Rock","country":"UK & Europe","released":"","duration":"7:28","duration-float":7.28} +{"id":"938808306","title":"Vagabondage","album":"Chroniques Urbaines","artist":"Dédale","genre":"Folk, World, & Country","country":"France","released":"","duration":""} +{"id":"277097001","title":"In The Name Of Love (Club Version)","album":"In The Name Of Love","artist":"Valerie (17)","genre":"Electronic","country":"Italy","released":"1994","duration":"5:47","released-timestamp":757382400,"duration-float":5.47} +{"id":"1080937408","title":"Music Goes 'Round And 'Round","album":"Music To Break A Sub-Lease","artist":"Don Costa's Free Loaders","genre":"Pop","country":"Australia","released":"1958","duration":"2:15","released-timestamp":-378691200,"duration-float":2.15} +{"id":"507486800","title":"When My Blue Moon Turns To Gold Again","album":"When My Blue Moon Turns To Gold Again / I Betcha My Heart I Love You","artist":"Zeke Manners Band","genre":"Folk, World, & Country","country":"US","released":"1947","duration":"","released-timestamp":-725846400} +{"id":"417262303","title":"Hush Little Baby (Knox Brown Remix)","album":"Hush Little Baby","artist":"Ed Sheeran","genre":"Hip Hop","country":"UK","released":"2012","duration":"","released-timestamp":1325376000} +{"id":"574890100","title":"Papa Don't Preach","album":"Papa Don't Preach","artist":"Madonna","genre":"Electronic","country":"Spain","released":"1986","duration":"4:27","released-timestamp":504921600,"duration-float":4.27} +{"id":"1403656829","title":"Lake Of Tenderness","album":"The Healing II: A Trip To Infinity","artist":"Various","genre":"Electronic","country":"Netherlands","released":"2000","duration":"3:22","released-timestamp":946684800,"duration-float":3.22} +{"id":"585257905","title":"Je Veux Être Aimée De Vous","album":"Marilyn Montreuil","artist":"Diane Tell","genre":"Pop","country":"France","released":"1991","duration":"","released-timestamp":662688000} +{"id":"1064336778","title":"We Built This City","album":"80 Hits Der 80er","artist":"Various","genre":"Pop","country":"Europe","released":"2009","duration":"4:36","released-timestamp":1230768000,"duration-float":4.36} +{"id":"1060949616","title":"Confession","album":"First Recordings","artist":"Pieter Van Der Staar","genre":"Classical","country":"Netherlands","released":"","duration":""} +{"id":"832244912","title":"Bella Morte","album":"Volume, Contrast, Brilliance... (Unreleased & Rare Vol.2)","artist":"The Monochrome Set","genre":"Pop","country":"Europe","released":"2016-03-25","duration":"","released-timestamp":1458864000} +{"id":"614652632","title":"Έκλαψα Χτες","album":"Τα Μεγάλα Τραγούδια","artist":"Μίμης Πλέσσας","genre":"Folk, World, & Country","country":"Greece","released":"2014-09-07","duration":"","released-timestamp":1410048000} +{"id":"1223170105","title":"Antichrist Superstar","album":"200% Ultra Hits '99","artist":"Marilyn Manson","genre":"Rock","country":"Russia","released":"1999","duration":"","released-timestamp":915148800} +{"id":"1198378200","title":"(There’s Gonna Be Another) Acid Attack","album":"Suburbia's Dream","artist":"Acid Attack (2)","genre":"Rock","country":"US","released":"2018","duration":"","released-timestamp":1514764800} +{"id":"1279996803","title":"Two Little Boys","album":"Winners","artist":"Rusty Draper","genre":"Folk, World, & Country","country":"US","released":"1997","duration":"","released-timestamp":852076800} +{"id":"1062195100","title":"Mull Of Kintyre","album":"Mull Of Kintyre / Girls School","artist":"Wings (2)","genre":"Rock","country":"Japan","released":"1977","duration":"4:42","released-timestamp":220924800,"duration-float":4.42} +{"id":"889959503","title":"Nao Há Dinheiro Que Pague","album":"Os Populares","artist":"Os Populares & Seu Ritmo","genre":"Pop","country":"Brazil","released":"1969-06-06","duration":"2:25","released-timestamp":-18057600,"duration-float":2.25} +{"id":"1504424100","title":"Havajas meitene","album":"Pāri Zilai Jūrai","artist":"Mazā Ģilde","genre":"Folk, World, & Country","country":"Latvia","released":"1996","duration":"4:01","released-timestamp":820454400,"duration-float":4.01} +{"id":"297592900","title":"Licantropo","album":"Broken Dreams EP","artist":"Alfonso Sanchez","genre":"Electronic","country":"Serbia","released":"2010-10-11","duration":"6:46","released-timestamp":1286755200,"duration-float":6.46} +{"id":"868823901","title":"Atomic","album":"Disco Gold","artist":"Unknown Artist","genre":"Pop","country":"UK","released":"","duration":""} +{"id":"889283902","title":"Get It","album":"AudioGraff","artist":"Frosty Da Knowmatic","genre":"Hip Hop","country":"US","released":"2015-12-15","duration":"2:57","released-timestamp":1450137600,"duration-float":2.57} +{"id":"937009611","title":"Scapegoat","album":"Hit Collection 2000","artist":"Guano Apes","genre":"Rock","country":"Russia","released":"2000","duration":"","released-timestamp":946684800} +{"id":"363495600","title":"Evil Ways","album":"Evil Ways","artist":"Buddy Miles","genre":"Funk / Soul","country":"Netherlands","released":"1972","duration":"3:18","released-timestamp":63072000,"duration-float":3.18} +{"id":"989698000","title":"Zuerst Ich","album":"Silvia","artist":"Silvia (3)","genre":"Electronic","country":"US","released":"2017-02-27","duration":"3:09","released-timestamp":1488153600,"duration-float":3.09} +{"id":"1296495105","title":"Beaches","album":"Solen","artist":"Nanna B","genre":"Funk / Soul","country":"Germany","released":"2018","duration":"","released-timestamp":1514764800} +{"id":"430701502","title":"Heretic Supremacy","album":"Noctis Armaggedon 666","artist":"Arkenstone","genre":"Rock","country":"","released":"1999","duration":"","released-timestamp":915148800} +{"id":"1532448802","title":"French-Canadian Jigs: Papineauville / Denis Lanctot's","album":"Northern Roots","artist":"David Surette","genre":"Folk, World, & Country","country":"US","released":"2005","duration":"","released-timestamp":1104537600} +{"id":"1397754001","title":"Fear Of Missing Out","album":"All You Have Is All You Need","artist":"Ainslie Wills","genre":"Pop","country":"Australia","released":"2019-08-09","duration":"3:43","released-timestamp":1565308800,"duration-float":3.43} +{"id":"1405685511","title":"左胸膛","album":"都市劲爆夜 俊男篇","artist":"Various","genre":"Pop","country":"China","released":"2003","duration":"","released-timestamp":1041379200} +{"id":"1007430807","title":"Saan","album":"Nápis Na Štítu Domu","artist":"Žalman & Spol.","genre":"Folk, World, & Country","country":"Czech Republic & Slovakia","released":"2010","duration":"3:39","released-timestamp":1262304000,"duration-float":3.39} +{"id":"473213500","title":"I Stillhet","album":"I Stillhet","artist":"Anne-Lie Rydé","genre":"Pop","country":"Sweden","released":"1985","duration":"5:10","released-timestamp":473385600,"duration-float":5.1} +{"id":"1259528812","title":"Se Bastasse Una Canzone","album":"Eros","artist":"Eros Ramazzotti","genre":"Pop","country":"Europe","released":"1997","duration":"5:22","released-timestamp":852076800,"duration-float":5.22} +{"id":"1428095201","title":"Easy Now","album":"Bottom Of The Barrel / Easy Now","artist":"Richie & The Saxons","genre":"Rock","country":"US","released":"","duration":""} +{"id":"173947807","title":"Razor Back","album":"Volume Junky","artist":"The Eight Bucks Experiment","genre":"Rock","country":"US","released":"2002","duration":"","released-timestamp":1009843200} +{"id":"817181700","title":"The White Cliffs Of Dover","album":"The White Cliffs Of Dover / Much Too Much","artist":"Lee Andrews & The Hearts","genre":"Rock","country":"US","released":"","duration":"2:48","duration-float":2.48} +{"id":"600959805","title":"Inferno","album":"Inferno","artist":"Darkside (10)","genre":"Rock","country":"Austria","released":"2013","duration":"","released-timestamp":1356998400} +{"id":"1056118647","title":"Lovin' Arms","album":"The Definitive Collection - The Mercury Years","artist":"Johnny Rodriguez (4)","genre":"Folk, World, & Country","country":"UK","released":"2014","duration":"2:52","released-timestamp":1388534400,"duration-float":2.52} +{"id":"467860516","title":"Sabiduria Popular","album":"Festival Salsero","artist":"Various","genre":"Latin","country":"Colombia","released":"1986","duration":"","released-timestamp":504921600} +{"id":"1064388100","title":"Let It Burn (Extended Mix)","album":"Let It Burn","artist":"Katherine Amy","genre":"Electronic","country":"Egypt","released":"2017-07-31","duration":"6:26","released-timestamp":1501459200,"duration-float":6.26} +{"id":"1164406901","title":"Long Journey","album":"I Heard the Voice of Jesus Say","artist":"The Inspirational Souls","genre":"Folk, World, & Country","country":"US","released":"","duration":"3:00","duration-float":3} +{"id":"1159826604","title":"桂花","album":"卉","artist":"Roman Tam","genre":"Pop","country":"Hong Kong","released":"1981","duration":"","released-timestamp":347155200} +{"id":"1276845701","title":"Atto Secondo","album":"La Serva Padrona - Die Magd Als Herrin","artist":"Siegmund Nimsgern","genre":"Classical","country":"Spain","released":"1975","duration":"","released-timestamp":157766400} +{"id":"844691310","title":"400 CPS","album":"Seeburg Test Record","artist":"No Artist","genre":"Non-Music","country":"US","released":"","duration":""} +{"id":"556803101","title":"Que Bonita Eres (Remix Club)","album":"Que Bonita Eres","artist":"Latinos Tres","genre":"Latin","country":"France","released":"1997","duration":"5:40","released-timestamp":852076800,"duration-float":5.4} +{"id":"564909003","title":"Everyday","album":"Buddy Holly's Greatest Hits","artist":"Buddy Holly","genre":"Pop","country":"UK","released":"","duration":""} +{"id":"1577039606","title":"Line For Lyons","album":"Line For Lyons","artist":"Chet Baker","genre":"Jazz","country":"Germany","released":"","duration":"2:20","duration-float":2.2} +{"id":"834606911","title":"L'Astronave Che Arriva","album":"I Love Jazz + Serenadas","artist":"Sergio Caputo","genre":"Latin","country":"Italy","released":"2009","duration":"","released-timestamp":1230768000} +{"id":"1092614603","title":"Tommy's Ballad","album":"The Bird Of Red And Gold","artist":"Barry Harris (2)","genre":"Jazz","country":"US","released":"1994","duration":"","released-timestamp":757382400} +{"id":"739686807","title":"Loudly","album":"So Beautiful People Look Away","artist":"VTG","genre":"Electronic","country":"","released":"2010-02-00","duration":"4:29","released-timestamp":1264982400,"duration-float":4.29} +{"id":"23452102","title":"Brainstorming","album":"Ladyland","artist":"Vinka","genre":"Electronic","country":"France","released":"2004","duration":"","released-timestamp":1072915200} +{"id":"1088193912","title":"Looking For An Angel","album":"La Mia Risposta","artist":"Laura Pausini","genre":"Pop","country":"Argentina","released":"1998","duration":"","released-timestamp":883612800} +{"id":"1032766501","title":"Embrush","album":"Contrast EP","artist":"Spark Taberner","genre":"Electronic","country":"Germany","released":"2013-10-01","duration":"8:22","released-timestamp":1380585600,"duration-float":8.22} +{"id":"1555364706","title":"Damenwahl","album":"Tanzen Stimmung Gute Laune","artist":"Various","genre":"Folk, World, & Country","country":"Germany","released":"","duration":""} +{"id":"540924007","title":"Fladderi - Fladderna","album":"Nygalet","artist":"Lennart Witoslaw","genre":"Pop","country":"Sweden","released":"1975","duration":"0:47","released-timestamp":157766400,"duration-float":0.47} +{"id":"1179960704","title":"B 612","album":"Dreamchaser","artist":"Sarah Brightman","genre":"Classical","country":"Australia","released":"2013-01-16","duration":"4:50","released-timestamp":1358294400,"duration-float":4.5} +{"id":"983029514","title":"Top Back (Clean)","album":"Atlantic Heat 10.5","artist":"Various","genre":"Hip Hop","country":"US","released":"2006","duration":"4:46","released-timestamp":1136073600,"duration-float":4.46} +{"id":"1247482107","title":"Va Yven","album":"Around The Campfire","artist":"Geula Gill","genre":"Folk, World, & Country","country":"US","released":"","duration":""} +{"id":"1133334000","title":"Groove Me","album":"King Floyd","artist":"King Floyd","genre":"Funk / Soul","country":"Germany","released":"1971","duration":"3:01","released-timestamp":31536000,"duration-float":3.01} +{"id":"612716506","title":"I Won The Drug War","album":"Vulgar Display Of Obscurity","artist":"Dick Delicious And The Tasty Testicles","genre":"Pop","country":"US","released":"2011","duration":"","released-timestamp":1293840000} +{"id":"47629203","title":"Not Necessarily So (Album Version)","album":"M6","artist":"Market","genre":"Hip Hop","country":"US","released":"1998","duration":"4:40","released-timestamp":883612800,"duration-float":4.4} +{"id":"460864801","title":"Broken Moon","album":"Already Broken","artist":"Pit Pony","genre":"Folk, World, & Country","country":"New Zealand","released":"1999","duration":"","released-timestamp":915148800} +{"id":"1286464709","title":"Who Can I Turn To (When Nobody Needs Me)","album":"Greatest Hits","artist":"The Main Ingredient","genre":"Funk / Soul","country":"Canada","released":"1973","duration":"4:48","released-timestamp":94694400,"duration-float":4.48} +{"id":"1033810715","title":"Puff....Bam","album":"The Very Best Of The Yardbirds","artist":"The Yardbirds","genre":"Pop","country":"US","released":"2007-12-15","duration":"","released-timestamp":1197676800} +{"id":"238210903","title":"Let's Go Down To The Woods And Pray","album":"The Peel Sessions","artist":"The Screaming Blue Messiahs","genre":"Rock","country":"US","released":"1986","duration":"3:20","released-timestamp":504921600,"duration-float":3.2} +{"id":"596846207","title":"Higher State Of Consciousness (Barrat & Falconi Remix)","album":"Bargrooves - The Black Collection","artist":"Various","genre":"Electronic","country":"UK","released":"2007-08-27","duration":"6:29","released-timestamp":1188172800,"duration-float":6.29} +{"id":"106177605","title":"Let's Dance","album":"Italian Style Compilation Vol. II","artist":"Various","genre":"Electronic","country":"Italy","released":"1991","duration":"2:20","released-timestamp":662688000,"duration-float":2.2} +{"id":"864850406","title":"Castle In The Sky","album":"Dream Things True","artist":"The Minstrel's Ghost","genre":"Rock","country":"US","released":"2011","duration":"3:35","released-timestamp":1293840000,"duration-float":3.35} +{"id":"543149404","title":"Niczego Nie Chcę Więcej","album":"Emocjonalny Terror","artist":"Tilt (4)","genre":"Rock","country":"Poland","released":"2002","duration":"","released-timestamp":1009843200} +{"id":"1321360301","title":"Your Love Is Amazing","album":"Chantilly Lace","artist":"Shorty Long (2)","genre":"Funk / Soul","country":"UK","released":"1967-03-17","duration":"","released-timestamp":-88214400} +{"id":"1000260718","title":"Gotta Broken Heart Again","album":"God And His Law","artist":"Prince","genre":"Pop","country":"Japan","released":"2016","duration":"","released-timestamp":1451606400} +{"id":"1368492556","title":"The Donkey Serenade","album":"Ritmo Caliente","artist":"Machito & His Afro-Cubans","genre":"Latin","country":"UK","released":"2002","duration":"","released-timestamp":1009843200} +{"id":"480574210","title":"Ich Bin Frei","album":"Hetzjagd Inferno","artist":"Hassmord","genre":"Rock","country":"Germany","released":"2013","duration":"","released-timestamp":1356998400} +{"id":"16777802","title":"The Seduction Of The Matahari","album":"Sienna","artist":"Baby Doc","genre":"Electronic","country":"UK","released":"1995-06-19","duration":"","released-timestamp":803520000} +{"id":"415934001","title":"Glory Of The Snow","album":"Cosodorokitsune","artist":"少女スキップ","genre":"Rock","country":"Japan","released":"2012-11-14","duration":"4:14","released-timestamp":1352851200,"duration-float":4.14} +{"id":"760577501","title":"Szerelembomba (Császár Előd Radio Mix)","album":"Szerelembomba","artist":"Back II Black","genre":"Pop","country":"Hungary","released":"1998","duration":"3:59","released-timestamp":883612800,"duration-float":3.59} +{"id":"392242902","title":"Davenport Blues","album":"The Bix Beiderbecke Era","artist":"Randy Sandke","genre":"Jazz","country":"Germany","released":"1993","duration":"3:22","released-timestamp":725846400,"duration-float":3.22} +{"id":"513735507","title":"Pretty Flamingo","album":"A Night On The Town","artist":"Rod Stewart","genre":"Rock","country":"Germany","released":"","duration":"3:27","duration-float":3.27} +{"id":"1151578600","title":"Red Sweater","album":"Cripple Creek Fairies","artist":"Cripple Creek Fairies","genre":"Rock","country":"Canada","released":"2001","duration":"","released-timestamp":978307200} +{"id":"403466508","title":"We Are The Power Rangers Of Hardcore","album":"Cut'n'Run / Tackleberry","artist":"Tackleberry","genre":"Rock","country":"Russia","released":"2006","duration":"","released-timestamp":1136073600} +{"id":"705489816","title":"Es Wart Gesant Gabriel","album":"Musik Der Reformation","artist":"Hans Grüß","genre":"Classical","country":"German Democratic Republic (GDR)","released":"1983","duration":"2:50","released-timestamp":410227200,"duration-float":2.5} +{"id":"276177902","title":"But The Shadow Marred The Master Plan","album":"Live In Berlin","artist":"United Front (2)","genre":"Jazz","country":"Germany","released":"1983-08-30","duration":"8:53","released-timestamp":431049600,"duration-float":8.53} diff --git a/tests/Meilisearch.Tests/DocumentTests.cs b/tests/Meilisearch.Tests/DocumentTests.cs index 8bdcb0fd..7467f9aa 100644 --- a/tests/Meilisearch.Tests/DocumentTests.cs +++ b/tests/Meilisearch.Tests/DocumentTests.cs @@ -82,6 +82,26 @@ public async Task BasicDocumentAdditionFromCsvString() Assert.Equal("Rock", doc.Genre); } + [Fact] + public async Task BasicDocumentAdditionFromNdjsonString() + { + var indexUID = nameof(BasicDocumentAdditionFromNdjsonString); + var index = _client.Index(indexUID); + + var ndjsonDocuments = await File.ReadAllTextAsync(Datasets.SongsNdjson); + var task = await index.AddDocumentsNdjsonAsync(ndjsonDocuments); + task.Uid.Should().BeGreaterOrEqualTo(0); + await index.WaitForTaskAsync(task.Uid); + + // Check the documents have been added + var docs = (await index.GetDocumentsAsync()).ToList(); + Assert.NotEmpty(docs); + var doc = docs.First(); + Assert.Equal("412559401", doc.Id); + Assert.Equal("BEETHOVEN", doc.Title); + Assert.Equal("Classical", doc.Genre); + } + [Fact] public async Task BasicDocumentsAdditionInBatches() { @@ -140,6 +160,34 @@ public async Task BasicDocumentAdditionFromCsvStringInBatches() Assert.Equal("Rock", doc.Genre); } + [Fact] + public async Task BasicDocumentAdditionFromNdjsonStringInBatches() + { + var indexUID = nameof(BasicDocumentAdditionFromNdjsonStringInBatches); + var index = _client.Index(indexUID); + + var ndjsonDocuments = await File.ReadAllTextAsync(Datasets.SongsNdjson); + var tasks = (await index.AddDocumentsNdjsonInBatchesAsync(ndjsonDocuments, 150)).ToList(); + Assert.Equal(2, tasks.Count()); + foreach (var u in tasks) + { + u.Uid.Should().BeGreaterOrEqualTo(0); + await index.WaitForTaskAsync(u.Uid); + } + + // Check the documents have been added from first chunk + var doc = await index.GetDocumentAsync("412559401"); + Assert.Equal("412559401", doc.Id); + Assert.Equal("BEETHOVEN", doc.Title); + Assert.Equal("Classical", doc.Genre); + + // Check the documents have been added from second chunk + doc = await index.GetDocumentAsync("276177902"); + Assert.Equal("276177902", doc.Id); + Assert.Equal("But The Shadow Marred The Master Plan", doc.Title); + Assert.Equal("Jazz", doc.Genre); + } + [Fact] public async Task BasicDocumentsAdditionWithAlreadyCreatedIndex() { @@ -285,6 +333,33 @@ public async Task BasicDocumentsUpdateFromCsvString() Assert.Equal("Rock", doc.Genre); } + [Fact] + public async Task BasicDocumentsUpdateFromNdjsonString() + { + var indexUID = nameof(BasicDocumentsUpdateFromNdjsonString); + var index = _client.Index(indexUID); + + // Add the documents + var task = await index.AddDocumentsAsync(new[] + { + new DatasetSong { Id = "412559401", Title = "NOT A TITLE", Genre = "NO GENRE" }, + }); + task.Uid.Should().BeGreaterOrEqualTo(0); + await index.WaitForTaskAsync(task.Uid); + + // Update the documents + var ndjsonDocuments = await File.ReadAllTextAsync(Datasets.SongsNdjson); + task = await index.UpdateDocumentsNdjsonAsync(ndjsonDocuments); + task.Uid.Should().BeGreaterOrEqualTo(0); + await index.WaitForTaskAsync(task.Uid); + + // Check the documents have been updated and added + var doc = await index.GetDocumentAsync("412559401"); + Assert.Equal("412559401", doc.Id); + Assert.Equal("BEETHOVEN", doc.Title); + Assert.Equal("Classical", doc.Genre); + } + [Fact] public async Task BasicDocumentsUpdateInBatches() { @@ -367,6 +442,42 @@ public async Task BasicDocumentUpdateFromCsvStringInBatches() Assert.Equal("Rock", doc.Genre); } + [Fact] + public async Task BasicDocumentUpdateFromNdjsonStringInBatches() + { + var indexUID = nameof(BasicDocumentUpdateFromNdjsonStringInBatches); + var index = _client.Index(indexUID); + + // Add the documents + var task = await index.AddDocumentsAsync(new[] + { + new DatasetSong { Id = "412559401", Title = "NOT A TITLE", Genre = "NO GENRE" }, + new DatasetSong { Id = "276177902", Title = "NOT A TITLE", Genre = "NO GENRE" }, + }); + await index.WaitForTaskAsync(task.Uid); + + var ndjsonDocuments = await File.ReadAllTextAsync(Datasets.SongsNdjson); + var tasks = (await index.UpdateDocumentsNdjsonInBatchesAsync(ndjsonDocuments, 150)).ToList(); + Assert.Equal(2, tasks.Count()); + foreach (var u in tasks) + { + u.Uid.Should().BeGreaterOrEqualTo(0); + await index.WaitForTaskAsync(u.Uid); + } + + // Check the documents have been added from first chunk + var doc = await index.GetDocumentAsync("412559401"); + Assert.Equal("412559401", doc.Id); + Assert.Equal("BEETHOVEN", doc.Title); + Assert.Equal("Classical", doc.Genre); + + // Check the documents have been added from second chunk + doc = await index.GetDocumentAsync("276177902"); + Assert.Equal("276177902", doc.Id); + Assert.Equal("But The Shadow Marred The Master Plan", doc.Title); + Assert.Equal("Jazz", doc.Genre); + } + [Fact] public async Task DocumentsUpdateWithPrimaryKey() { diff --git a/tests/Meilisearch.Tests/Meilisearch.Tests.csproj b/tests/Meilisearch.Tests/Meilisearch.Tests.csproj index d830a9e8..e031e16c 100644 --- a/tests/Meilisearch.Tests/Meilisearch.Tests.csproj +++ b/tests/Meilisearch.Tests/Meilisearch.Tests.csproj @@ -21,6 +21,7 @@ +