Shortly before the development of a project, need to use the SOLR, because so in the beginning to find information on the Internet, but found that most of the information is very one-sided, or just to explain how SOLR installed, or only to explain a certain part of SOLR, and a lot of information is the same, It is difficult to find a person to reprint another person from the SOLR configuration, to connect with the database in the actual project, and because SOLR is developed using Java, most of the real-world instances are Java versions, and the. NET version is few, So it's hard for a. NET developer to learn SOLR without anyone else's explanation, so I'd like to write a series of SOLR tutorials that let a. NET developer without the SOLR foundation see that I can then know the SOLR principle, the important file configuration, the meaning of most parameters, It is also easy to use in. NET projects.
So before we learn what is SOLR first look at the official explanation:
SOLR is a stand-alone enterprise Search application server that provides API interfaces similar to Web-service. The user can submit files such as Xml,json, etc., to the Search engine server via HTTP request, generate the index, or make a lookup request via HTTP GET operation, and get the return result of Xml,jsond and other formats, SOLR is a high performance, using JAVA5 development, Lucene-based full-text Search server. At the same time, it is extended to provide a richer query language than Lucene, while it can be configured, extensible and optimized for query performance, and provides a perfect function management interface, is a very good full-text search engine.
The official definition said here, this definition of the online pile of a bunch of and are the same, want to know the friends can go to Baidu, basically is a version, so do not waste everyone's time, the following say I understand SOLR:
SOLR is to convert the data of the database through certain index rules into a local file that is easy to retrieve, the suffix of the file is. FDT, and then we go through SOLR to access these local files (which are done internally by SOLR), which speeds up the indexing speed, and SOLR is written in Java, So it needs to run on the Tomcat server, we can access the SOLR in a generic HTTP request, and get the data.
In a little digression, SOLR is basically configuring the appropriate files, which is very strange for many. NET programmers, because we are always accustomed to using ready-made, packaged things to use, over time, easy to become lazy, a little trouble to meet the configuration is difficult (this is a lot of. NET Programmer's Common problem I have previously instructed a. NET programmer who wants to learn SOLR on the Internet, and he comes up with a word, there are no ready-made examples, give me a copy, and then I say no, say this need in Tomcat
In the configuration of many XML files, the actual combination with the code is actually very little, solr most of the things are in the configuration, and then the programmer almost gave up on SOLR study, after the simple to say a few words to the end of the conversation.
In the first section, we will explain the installation and configuration of SOLR (this basic is the same as everyone else)
Since SOLR was developed in Java, it needs to be run in Tomcat, so the first step is to install the JDK (the jdk1.7 i installed here), with Tomcat (the choice is TOMCAT7), these two installations are not here to talk about, online a lot of
1. Download Tomcat and SOLR and unzip (install the JDK before installing)
After Tomcat decompression, the disk path is C:/Program Files/apache software foundation/tomcat 7.0 (path arbitrary).
2. Start the Tomcat server
Browser input: http://localhost:8080
This is done in order to generate the Catalina/localhost directory under the tomcat/conf directory, which will be used in the next step.
3. Download SOLR package on the official website i downloaded the solr-4.7.2.
Deploy SOLR to Tomcat
A) Copy the solr-4.7.2 directory EXAMPLE/SOLR to the Tomcat root directory
b) Copy the solr-4.7.2 directory Dist/solr-4.7.2.war to Tomcat Webapps/solr.war (rename);
c) Copy all jars under solr-4.7.2 directory Example/lib/ext to Tomcat, and copy the Log4j.properties file under Example/resources to Tomcat Lib;
d) Create a solr.xml file under Tomcat/conf/catalina/localhost, with the following content:
4. Restart the Tomcat server, enter HTTP://LOCALHOST:8080/SOLR view service in the browser, the following interface appears to install successfully.
installation IK Word breaker
1.http://code.google.com/p/ik-analyzer/downloads/detail?name=ik%20analyzer%202012ff_hf1.zip&can=2&q=
2. Copy the following IK participle to unpack the following three files below to the Tomcat7\webapps\solr\web-inf\lib\ folder below:
IKAnalyzer.cfg.xml, Ikanalyzer2012ff_u1.jar, Stopword.dic
3. Modify the Schema.xml in the Tomcat7\solr\collection1\conf\ folder. In <types></types>
Add the following content:
<!--Configure the IK word breaker-name is the name below you can choose the word breaker > <fieldtype name= "Text_ik" class= "SOLR. TextField "> <!--the word breaker at index time - <Analyzertype= "Index"Ismaxwordlength= "false"class= "Org.wltea.analyzer.lucene.IKAnalyzer"/> <!--the word breaker when querying - <Analyzertype= "Query"Ismaxwordlength= "true"class= "Org.wltea.analyzer.lucene.IKAnalyzer"/> </FieldType>
4. Start Tomcat, enter HTTP://LOCALHOST:8080/SOLR in the browser, select Core as Collection1 in the left menu of the page, click the analysis (Funnel shape) menu, and on the right page filed In the Value text box, enter the Chinese string to test the word breaker.
5. Under field value, select Text_ik (my name is TEXT_CN) in analyse Fieldname/fieldtype, then click on the left Analyze value button to see the result of the participle.
As follows:
OK above is SOLR installation, this is only the first step, it still can not do anything, the next section we will explain the SOLR configuration file.
SOLR and. NET Series courses (i) SOLR installation and configuration