Exemplo n.º 1
0
        public int DeleteTrack(IModelReference trackReference)
        {
            int subIds = this.DeleteSubFingerprintsForTrack(trackReference);

            this.solrForTracksCore.Delete(SolrModelReference.GetId(trackReference));
            this.solrForTracksCore.Commit();
            return(1 + subIds);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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
     });
 }
Exemplo n.º 5
0
        public IList <HashedFingerprint> ReadHashedFingerprintsByTrackReference(IModelReference trackReference)
        {
            var results = solr.Query(string.Format("trackId:{0}", SolrModelReference.GetId(trackReference)));

            return(results.Select(GetHashedFingerprint).ToList());
        }