Closed Fatalityap closed 6 years ago
Anyway, maybe someone can post me example of working code that are uses Solr Net Cloud Unity component ? )
I personally haven’t used SolrNet Cloud nor Unity, but I will see if I can debug this early next week.
@gjunge Thanks a lot! I have successfully used Common Service Locator for Solr Net Cloud but I don't think that it will be acceptable for us because of it limitations.
That is good to know, meaning SolrNet.Cloud itself works good, except for the Unity integration.
@gjunge That is good to know, meaning SolrNet.Cloud itself works good, except for the Unity integration. - Yes. ) At least I can run simple query. )
I can't seem to recreate it:
Here are tests dealing with SolrCloud with Unity: https://github.com/SolrNet/SolrNet/blob/issues/385/SolrNet.Cloud.Tests/UnityTests.cs I added your sample , but it works fine.
What might happen though is that some async error occurs in the SolrCloudProvider, could you try
var provider = new SolrCloudStateProvider("desktop-lmqi80k:9984");
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<Camera>>();
SolrQueryResults<Camera> cameras = obj.Query(new SolrQueryByField("Name", "Canon"));
Console.WriteLine("Product: " + cameras.FirstOrDefault().Name);
Console.WriteLine("Test");
Console.ReadKey();
}
And see if is all good.
Hi, thanks for help, but error is stay the same. I have created simple project with this chunk of code. Can you look at it?
Great, I was able to reproduce the issue, I will now check what the problem is.
I think actually you are not connected to the zookeeper. What value does the colcount variable have in the code snippet above, and what does the state variable show?
I added to version 1.0.5 of SolrNet , a check to see if we are connected to the zookeeper instance.
Hi, thanks. It is working. For now exception is changed:
System.AggregateException
HResult=0x80131500
Message=One or more errors occurred. (Cannot connect to the Zookeeper instance desktop-lmqi80k:9984. Current state: CONNECTING )
Source=System.Private.CoreLib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at SolrPOC.Program.Main(String[] args) in D:\POC\SolrPOC\SolrPOC\Program.cs:line 27
Inner Exception 1:
SolrNetCloudConnectionException: Cannot connect to the Zookeeper instance desktop-lmqi80k:9984. Current state: CONNECTING
I will try to fix error with Zookeeper, but for now it is more clear what is happening )
But will you update Nuget packages?
Yes we will update the nuget packages. @xavier-morera 1.0.5 currently contains a small change and could be published.
Thanks @Fatalityap and @gjunge for fixing this issue. I have updated NuGet to 1.0.5
Thanks for help! ) All is working properly, at least Solr Cloud Unity in this case.
Hi I am using Solr.Net.Cloud.Unity ver. 1.0.3, Solr.Net.Cloud.Core ver. 1.0.3, Unity ver. 5.0.0 in .NET Standard 2.0 Console Application. Here is code:
And I receive this error:
Exception is thrown on this line:
var obj = cont.Resolve<ISolrOperations<Camera>>();
Where Camera is:
Can you tell me what is wrong?
I can provide additional info if you need some. Thanks!