Hello to all, I am new in SolrNet and I whant to built web application that shows some results from Solr, and I have some trouble to do it.--Ok, let's go. I whant to create web application with asp.net MVC 4 that shows (query) all "customer" from my Solr.First I have open new Visual Studio 2012 project for MVC 4 - Empty solution and name it TestSolr.Second I have tru Package Manager Console instal next packages:
- SolrNet (core library)
- SolrNet.Windsor
- SolrNet.StructureMap
- SolrNet.Ninject
- SolrNet.Unity
- SolrNet.Autofac
- SolrNet.NHibernate
Third I have create new Models and name it "Poskus" and write code below:using SolrNet.Attributes;namespace TestSolr.Models{public class Poskus{[SolrField("customer")]public string Customer { get; set; }}}Forth I have create new Controller with name "PoskusSolrController" and write code below:using System.Web.Mvc;using SolrNet;using SolrNet.DSL;using TestSolr.Models;namespace TestSolr.Controllers{public class PoskusSolrController : Controller{//// GET: /PoskusSolr/public ActionResult Index(){Startup.Init<Poskus>("http://servicemix01...msglog_pilot");var pos1 = Solr.Query<Poskus>(new SolrQueryByField("name", "customer"));return View(pos1);}
}}Fifth I have create View with name "Index" and write code below:@model IQueryable<TestSolr.Models.Poskus>@{ViewBag.Title = "Index";}<h2>Index</h2>@foreach (var item in Model){<div><div>@item.Customer</div></div>}-----------------------Now, this code is not working correctly. The error pops up in this line of code: var pos1 = Solr.Query<Poskus>(new SolrQueryByField("name", "customer")); the error is: NullReferenceException was unhandled by code.Realy need help here, some sugestions, links, similar experience... realy thanks for help,Daniel
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to solrnet+u...@googlegroups.com.
To post to this group, send email to sol...@googlegroups.com.
Visit this group at http://groups.google.com/group/solrnet.
For more options, visit https://groups.google.com/d/optout.
private static readonly string solrURL = ConfigurationManager.AppSettings["solrUrl ... <= here I put url of "http://servicemix..."]; <= tis lineprotected void Application_Start() {XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(Server.MapPath("/"), "log4net.config")));RegisterRoutes(RouteTable.Routes);var connection = new SolrConnection(solrURL);var loggingConnection = new LoggingConnection(connection);Startup.Init<Product>(loggingConnection);}