question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Specifying collection in Solr Net Cloud Unity

See original GitHub issue

Hi, 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:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
xmoreracommented, Feb 22, 2018

Hi @Fatalityap would it be possible to stick to using issues or StackOverflow instead of direct contact? Just for the following reasons:

  1. This is volunteer work, so unless @gjunge or someone else wants to perform direct consulting which is 100% fine if both parties agree, I believe in respecting privacy and letting people help whenever they get a chance. People usually have a busy life and I know that @gjunge is working on several things at a time
  2. If @gjunge answers one of your questions here, the entire community benefits

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?

0reactions
Fatalityapcommented, Feb 27, 2018

@xavier-morera I hear you. Thanks for answer. I also agree with your point of view.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found