lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nazik <nazik...@yahoo.com>
Subject Re: Asp.net MVC 4 and Solr Query Begining
Date Tue, 01 Apr 2014 09:51:26 GMT
Hi Daniel,

I think you should post this to SOLR.NET google group:

https://groups.google.com/forum/m/#!forum/solrnet

That forum is more appropriate to address  this type of problem.

@Nazik_Huq 


On Apr 1, 2014, at 5:30 AM, danielkrudolf <daniel.k.rudolf@gmail.com> wrote:

> Hello to all, I am new in Solr, but I see it si very usable. So I whant to
> build web application with asp.net MVC 4 that shows query from Solr. 
> 
> Ok, let's go so far i have done this:
> 
> 1) Open new project in Visual Studio 2012 and create new MVC 4 project
> (Empty solution).
> 
> 2) In Package Manager Console I have Install next packages:
> /SolrNet (core library)
> SolrNet.Windsor
> SolrNet.StructureMap
> SolrNet.Ninject
> SolrNet.Unity
> SolrNet.Autofac
> SolrNet.NHibernate/
> 
> 3) I create new Model class with name "Poskus" and write this code:
> using SolrNet.Attributes;
> 
> /namespace TestSolr2.Models
> {
>    public class Poskus
>    {
> 
>        [SolrField("customer")]
>        public string Customer { get; set; }
> 
>    }
> }/
> 
> 4) Next I have create new Controller with name "PoskusSolr" and write this
> code:
> 
> /using System;
> using System.Web.Mvc;
> using SolrNet;
> using SolrNet.DSL;
> using TestSolr.Models;
> using SolrNet.Impl;
> 
> namespace TestSolr.Controllers
> {
>    public class PoskusSolrController : Controller
>    {
>        //
>        // GET: /PoskusSolr/
> 
>        public ActionResult Index()
>        {
> 
>            try
>            {
>                var connection = new
> SolrConnection("http://servicemix/.../msglog_pilot");
>                Startup.Init<Poskus>(connection);
> 
>                var pos1 = Solr.Query<Poskus>(new SolrQueryByField("name",
> "customer"));
> 
>                return View(pos1);
>            }
>            catch (Exception ex)
>            {
>                string error = ex.Message;
>            }
>            return View();
>        }   
>    }
> }/
> 
> 5) And finaly I have create View (Index) 
> 
> So far I put this:
> 
> /@model TestSolr.Models.Poskus
> @{
>    ViewBag.Title = "Index";
> }
> 
> Index
> /
> 
> ---------------------------------------------
> Now, this code does not work, it not returns customers from my Solr databse.
> Any sugestions, ideas, links to make this work. Realy, realy thanks for
> help.
> 
> Daniel
> 
> 
> 
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Asp-net-MVC-4-and-Solr-Query-Begining-tp4128372.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Mime
View raw message