public int DeleteTrack(IModelReference trackReference) { int subIds = this.DeleteSubFingerprintsForTrack(trackReference); this.solrForTracksCore.Delete(SolrModelReference.GetId(trackReference)); this.solrForTracksCore.Commit(); return(1 + subIds); }
public TrackData ReadTrack(IModelReference trackReference) { var trackId = SolrModelReference.GetId(trackReference); var query = new SolrQuery(string.Format("trackId:{0}", trackId)); var results = this.solrForTracksCore.Query(query); return(FirstFromResultSet(results)); }
private int DeleteSubFingerprintsForTrack(IModelReference trackReference) { string trackId = SolrModelReference.GetId(trackReference); string readAll = string.Format("trackId:{0}", trackId); var results = solrForSubfingerprintsCore.Query(new SolrQuery(readAll)); var ids = results.Select(dto => dto.SubFingerprintId).ToList(); solrForSubfingerprintsCore.Delete(ids); solrForSubfingerprintsCore.Commit(); return(ids.Count); }
private SubFingerprintDTO GetSubFingerprintDto(IModelReference trackReference, HashedFingerprint hash) { return(new SubFingerprintDTO { SubFingerprintId = Guid.NewGuid().ToString(), Hashes = dictionaryToHashConverter.FromHashesToSolrDictionary(hash.HashBins), SequenceAt = hash.StartsAt, SequenceNumber = hash.SequenceNumber, TrackId = SolrModelReference.GetId(trackReference), Clusters = hash.Clusters }); }
public IModelReference InsertTrack(TrackData track) { Guid id = Guid.NewGuid(); var dto = new TrackDTO { Id = id.ToString(), Album = track.Album, Artist = track.Artist, ISRC = track.ISRC, ReleaseYear = track.ReleaseYear, Title = track.Title, TrackLengthSec = track.Length }; this.solrForTracksCore.Add(dto); this.solrForTracksCore.Commit(); var trackReference = new SolrModelReference(id.ToString()); track.TrackReference = trackReference; return(trackReference); }
public IList <HashedFingerprint> ReadHashedFingerprintsByTrackReference(IModelReference trackReference) { var results = solr.Query(string.Format("trackId:{0}", SolrModelReference.GetId(trackReference))); return(results.Select(GetHashedFingerprint).ToList()); }