?? SOLR is a full-text retrieval server based on Lucene, and provides some API interfaces like WebService, which allows the user to create an index and search through an HTTP request SOLR server.
Indexing process: User-submitted text will be word breaker, the word after the keyword will be stored in the Index Library, index library is a keyword and target document mapping set.
Index Search process: The user submits the search text also passes through the parser, obtains the keyword to go to the index library to query the corresponding target document and returns to the client, uses the weight sorting algorithm.
Installation of 1.SOLR
2. Installation of Chinese word breaker
Configuration information:
<!--Chinese word breaker - <FieldTypename= "Text_ik"class= "SOLR." TextField "> <Analyzertype= "Query"Ismaxwordlength= "true"class= "Org.wltea.analyzer.lucene.IKAnalyzer"/> <Analyzertype= "Index"Ismaxwordlength= "false"class= "Org.wltea.analyzer.lucene.IKAnalyzer"/> </FieldType>
3.1 Dih Full-volume synchronization
Related configuration information:
<!--Data Import Configuration - <RequestHandlername= "/dataimport"class= "Org.apache.solr.handler.dataimport.DataImportHandler"> <LSTname= "Defaults"> <Strname= "config">Data-config.xml</Str> </LST> </RequestHandler>
3.2
Related configuration information:
3.3 Schema.xml Synchronization Field configuration
Related configuration information:
<!--synchronizing the fields of a MySQL crawler - <Fieldname= "Create_date"type= "Date"indexed= "true"stored= "true"/> <Fieldname= "Update_date"type= "Date"indexed= "true"stored= "true"/> <Fieldname= "News_url"type= "Text_general"indexed= "true"stored= "true"/> <Fieldname= "News_origin"type= "Text_general"indexed= "true"stored= "true"/> <Fieldname= "Key_word"type= "Text_general"indexed= "true"stored= "true"/> <Fieldname= "news_html"type= "Text_ik"indexed= "true"stored= "true"/> <Fieldname= "Is_publish"type= "int"indexed= "true"stored= "true"/> <Fieldname= "Is_del"type= "int"indexed= "true"stored= "true"/> <Fieldname= "Flag_number"type= "Text_general"indexed= "true"stored= "true"/> <Fieldname= "Out_line"type= "Text_ik"indexed= "true"stored= "true"/> <Fieldname= "State"type= "int"indexed= "true"stored= "true"/> <!--Synchronize MySQL crawler field end -
4.1DIH Incremental sync (in fact, modify the Data-config.xml configuration file)
Related configuration information:
<Dataconfig> <DataSourceDriver= "Com.mysql.jdbc.Driver"URL= "Jdbc:mysql://192.168.40.1:3306/shanghang"User= "root"Password= "root" /> <Document> <Entityname= "Consensus_data2"PK= "id"Transformer= "Dateformattransformer"Query= "SELECT * from consensus_data2 where ID >= ' ${dataimporter.request.id} '"Deltaimportquery= "SELECT * from consensus_data2 where id = ' ${dih.delta.id} '"Deltaquery= "SELECT id from consensus_data2 where create_date > ' ${dataimporter.last_index_time} '"> <Fieldcolumn= "id"name= "id" /> <Fieldcolumn= "Create_date"name= "Create_date"DateTimeFormat= ' Yyyy-mm-dd HH:mm:ss '/> <Fieldcolumn= "Update_date"name= "Update_date"DateTimeFormat= ' Yyyy-mm-dd HH:mm:ss ' /> <Fieldcolumn= "News_url"name= "News_url" /> <Fieldcolumn= "News_origin"name= "News_origin" /> <Fieldcolumn= "KeyWord"name= "Key_word" /> <Fieldcolumn= "news_html"name= "news_html" /> <Fieldcolumn= "Is_publish"name= "Is_publish" /> <Fieldcolumn= "Is_del"name= "Is_del" /> <Fieldcolumn= "Flag_number"name= "Flag_number" /> <Fieldcolumn= "Out_line"name= "Out_line" /> <Fieldcolumn= "State"name= "State" /> </Entity> </Document></Dataconfig>
A tomcat-based SOLR environment build (Linux)