Specifying collection in Solr Net Cloud Unity
See original GitHub issueHi, how can I specify collection to write and read when using Solr Net Cloud Unity integration.
If I use following code it is writing to first created collection, witch is not stable for me.
Here is a code:
public class NumberPlate
{
[SolrField("id")]
public string Id { get; set; }
[SolrField("Number")]
public string Number { get; set; }
[SolrField("Organization")]
public string Organization { get; set; }
[SolrField("FirstName")]
public string FirstName { get; set; }
[SolrField("LastName")]
public string LastName { get; set; }
[SolrField("CountryOfRegistration")]
public string CountryOfRegistration { get; set; }
}
class Program
{
static void Main(string[] args)
{
MainAsync().Wait();
}
static async Task MainAsync()
{
//desktop-lmqi80k
var provider = new SolrCloudStateProvider("desktop-lmqi80k:9983");
await provider.InitAsync();
var state = provider.GetCloudState();
var colcount = state.Collections.Count;
using (var container = new UnityContainer())
{
var cont = new Unity.SolrNetCloudIntegration.SolrNetContainerConfiguration().ConfigureContainer(provider, container);
var obj = cont.Resolve<ISolrOperations<NumberPlate>>();
obj.Add(new NumberPlate()
{
CountryOfRegistration = "Ukraine",
FirstName = "Alexey",
LastName = "Ponomarenko",
Id = Guid.NewGuid().ToString(),
Number = "AA 6800 OB",
Organization = "KPI"
});
SolrQueryResults<NumberPlate> numberplates = obj.Query(new SolrQueryByField("CountryOfRegistration", "Ukraine"));
Console.WriteLine("Product: " + numberplates.FirstOrDefault().Number);
Console.WriteLine("Test");
Console.ReadKey();
}
}
}
Where can I specify collection to write and read (query)?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Collection Management Commands
A collection is a single logical index that uses a single Solr configuration file ( solrconfig.xml ) and a single index schema. All...
Read more >adding document to collection failed in Solr cloud mode
Drop the anchor and use the actual collection update URL: http://mysolr.net:8983/solr/collection_indexer/update/json/docs should work.
Read more >Setting up Solr with Sitecore 7 - Explorations
Go to the Sitecore desktop control panel, select "Indexing", then "Generate the Solr Schema. · Under source, put the path the full path...
Read more >Collection Management Commands
A collection is a single logical index that uses a single Solr configuration file ( solrconfig.xml ) and a single index schema.
Read more >SolrNet.Unity 1.1.1
SolrNet is a .NET Open Source client for Apache Solr. This version of SolrNet is compatible with Solr 1.x to Solr 7.x.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @Fatalityap would it be possible to stick to using issues or StackOverflow instead of direct contact? Just for the following reasons:
Please both let me know if you are ok with my response. If @gjunge wants to help @Fatalityap directly is fine, but if you can share your knowledge with the rest of the community, it is way better.
Thoughts?
@xavier-morera I hear you. Thanks for answer. I also agree with your point of view.