Created
June 19, 2015 13:32
-
-
Save rodolfofadino/97056ec609ada716fbc8 to your computer and use it in GitHub Desktop.
Update SOLR Document c#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void ExportClientesToSolr(List<Cliente> listaDeClientes) | |
{ | |
Startup.Init<Cliente>("http://solr-server:8080/solr/solrcluster/"); | |
ISolrOperations<Cliente> solr = ServiceLocator.Current.GetInstance<ISolrOperations<Cliente>>(); | |
var total = listaDeClientes.Count(); | |
var indice = 0; | |
foreach (var cliente in listaDeClientes) | |
{ | |
indice++; | |
Console.WriteLine(((((decimal)indice / (decimal)total) * (decimal)100)).ToString("N2") + " %"); | |
solr.Add(new Cliente() { Id = cliente.Id, Nome = cliente.Nome }); | |
//solr.Commit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment