Share

Wednesday 24 August 2011

Solr Text search engine with .NET

Solr set Up:


In this post  I am toking about how to set up  solr . Next blog ,I will be talking  about solr net and how to indexing by using solr engine

What is Solr?


Solr is an open source full text search engine that is used for  speed up the text search. Its major features  are :full-text search, highlighting, faceted search, dynamic clustering, database integration, rich document handling, and geospatial search. Solr is highly scalable, providing distributed search and index replication, and it powers the search and navigation features of many of the world's largest internet sites.
solr

Installations:


Install Java Runtime Engine (JRE)


o   Install file name “jre-6u22-windows-x64.exe”

o   Use default options when installing

Install Apache Tomcat


o   Install file name “apache-tomcat-6.0.32.exe”

o   Use default options when installing (port: 8080)

o   When selecting which items to install, make sure you select:

§  Tomcat àService Startup

§  Tomcat àNative



o   When prompted to choose a username and password, use the following:

§  Username: charith

§  Password: *****

Install Solr


  • Edit the file named “server.xml” under c:\program files\Apache\tomcat\conf\ to add the URIEncoding Connector element as shown in the picture below:


  • Stop the Tomcat service (right-click the little icon in the bottom-right in the taskbar and select Stop Service)




  • Copy the solr.war file to C:\program files\apache\tomcat\lib
  • Start the Tomcat service (right-click the Apache icon again in the taskbar and click Start Service)

 


Post-Installation steps:


Configure Tomcat Service


In Services console (Start à Run à services.msc) change the “Apache Tomcat 6” Service startup type to “Automatic” and all recovery options to “Restart the Service” (see following screenshots)










 


Delete Tomcat Startup Registry Key


Use the following command to delete the Apache Tomcat startup registry key (you have to run this with elevated privileges so launch the Command Prompt as Administrator):

reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v ApacheTomcatMonitor
Now type following URL in the browser http://localhost:8080/solr then you can see Solr homepage. Now you must download SolrNet.dll to your local machine and add to the reference. First, we have to map the Solr document to a class. Let's use a subset of the default schema that comes with the Solr distribution
It's just a POCO with some attributes: SolrField maps the attribute to a Solr field and SolrUniqueKey (optional but recommended) maps an attribute to a Solr unique key field. Now we'll write some tests using this mapped class. Let's initialize the library: (In web application this code should add to the Global.asax.ca file)