I am trying to map the custom fields in the Solrnet. But some how its failing to map the newly added fields. Can someone please assist me doing the same.
//working code start
Startup.InitContainer();
ISolrOperations<HtmlContent> solr = ServiceLocator.Current.GetInstance<ISolrOperations<HtmlContent>>();
//Read a file.
FileStream fileStream = System.IO.File.OpenRead(@"D:\SolrUpload\123.pdf");
//Approach 1:- Adds/Updates the extracted content of a Rich Document.
ExtractResponse response =
solr.Extract(
new ExtractParameters(fileStream, "123.pdf")
{
ExtractFormat = ExtractFormat.Text,
ExtractOnly = false,
//StreamType = "text/html" //for XML files
StreamType = "application/pdf", //for PDF files
//StreamType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
Fields = new[]
{
new ExtractField("userRole", "1")
,new ExtractField ("Tags","Tagging")
, new ExtractField("comments", "New")
, new ExtractField("category", "PDF Documents")
, new ExtractField("popularity", "1")
}
});
content = response.Content;
//code to convert the stream into string so that we can pass this content directly to the solr.Add() method.
using(StreamReader reader = new StreamReader(fileStream, Encoding.UTF8))
{
content = reader.ReadToEnd();
}
solr.Commit();
//working code end
ViewBag.Message = "Modify this template to jump-start your
ASP.NET MVC application.";
return View();
am I missing any step in between... Any kind of help for this is appreciated.