0
votes

I'm trying to use the Azure Cognitive Search UI. I have cloned the repository for the Knowledge Mining solution accelerator (git clone https://github.com/Azure-Samples/azure-search-knowledge-mining.git). When running the solution, it throws a system null reference exception (Object reference not set to an instance of an object) pointing out the Home Controller file.

Does anyone know how to solve this issue?

Thanks, Frank

1
Can you show the code where the error occurs?Tim Bassett
See the code below, public ActionResult Suggest(string term, bool fuzzy = true) { var response = _docSearch.Autocomplete(term, fuzzy); List<string> suggestions = new List<string>(); if (response != null) { foreach (var result in response.Results) { suggestions.Add(result.Text); } }user15074364
See the exception and code below, > System.NullReferenceException > HResult=0x80004003 >Message=Object reference not set to an instance of an object. > Source=CognitiveSearch.UI > StackTrace: > at CognitiveSearch.UI.Controllers.HomeController.Suggest(String term, Boolean > fuzzy) in C:\Users***\source\repos\azure-search-knowledge-mining\02 - Web UI > Template\CognitiveSearch.UI\Controllers\HomeController.cs:line 182user15074364
sorry about the formatting but I'm new using stackoverflowuser15074364

1 Answers

0
votes

The type of error you mention are almost always caused by some sort of issue with the appsettings.json file where the servicename/api key/ etc. are set. One good way to debug is to put a breakpoint in the constructor of DocumentSearchClient.cs. on lines 59 and 81. There you can catch potentially catch the error and then dig into the inner exception.

If the debugging doesn't reveal the problem, do raise an issue on the git repo.