开发者

Solrnet /ASP.NET sample without MVC

I am trying to get a handle on Solrnet and interacting an ASP.NET site with a Solr server. However, the sample app (on the code repository) is MVC based ,does anyone know of a version in plain vanilla ASP.N开发者_JS百科ET?

Thanks


There aren't any major differences really:

  • Initialize the library in your Application_Start() just like in the MVC sample app.
  • The simplest way to use it in a code-behind is to use the service locator to get the main SolrNet interface (e.g. var solr = ServiceLocator.Current.GetInstance<ISolrOperations<MyDocumentClass>>()), (in MVC it's easy to instead inject the interface using an IoC container)
  • Then you can use that instance to run any query you want, update documents, etc. In the MVC sample app a ModelBinder is used to get the search parameters from the querystring, but that's a MVC feature, so getting the search parameters is up to you.
  • Then bind the query results to the page (I mostly use a simple foreach, you could also try ObjectDataSource)


This is little late. But for people still looking for Solrnet /ASP.NET sample without MVC can look at the following: http://crazorsharp.blogspot.com/2010/01/full-text-search-using-solr-lucene-and.html http://blog.dileno.com/archive/201009/get-started-using-solr-for-search-with-aspnet/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜