Ejemplo n.º 1
0
        public void Should_batch_add_records_to_solr()
        {
            log4net.Config.XmlConfigurator.Configure();
            // work out a batch strategy
            const int batchNumber = 1000;

            // get list of songs
            string pathToItunesLibrary = ConfigSettings.PathToXml;

            IEnumerable<Song> songs = new LibraryBuilder<Song>().BuildLibrary(pathToItunesLibrary);
            songs = songs.Where(x => !string.IsNullOrEmpty(x.Artist) && !string.IsNullOrEmpty(x.Album));
            var indexer = new BatchedIndexer<Song>(new SolrCastleResolver<Song>()) {BatchBy = batchNumber};

            indexer.GenerateIndex(songs);
        }