introduction to lucene and solr - 2
TRANSCRIPT
1
Day 2 –Solr Hands OnCore Tech @Trend Micro
吳奕慶 YI-CHING WU
2 Preparation
NB/PC or VM
Install JRE
Install Tomcat on Windows / Linux
Download Solr 4.6
Download JDBC : sqljdbc4.jar
Un-Zip Solr 4.6
3 Install Solr on Windows install java runtime
download Tomcat windows service and install it to d:\Tomcat
test Tomcat site http://localhost:8080
stop Tomcat
download Solr and Unzip to d:\tempsolr
copy d:\tempsolr\dist\solr-x.x.x.war to d:\tomcat
rename d:\tomcat\solr-x.x.x.war to d:\tomcat\solr.war
copy d:\tempsolr\example\solr\ to d:\websolr\
add Java Options -Dsolr.solr.home=d:\websolr
add Java Options -Dsolr.velocity.enabled=false
copy d:\tempsolr\example\lib\ext to d:\tomcat\webapps\solr\WEB-INF\lib\
created:\tomcat\webapps\solr\WEB-INF\classes\
copy d:\tempsolr\example\resource\log4j.properties to d:\tomcat\webapps\solr\WEB-INF\classes\
start Tomcat
visit http://localhost:8080/solr/
4 Setup Schema.xml
Data source overview
Edit the schema.xml
5 Import Data to Solr- Data import Handler
Conntect to “TW-TSDev01”
Add new “/dataimport” request handler
Edit “data.import.xml"
Command
http://localhost:8080/solr/core0/dataimport?command=full-import&commit=ture
http://localhost:8080/solr/core0/dataimport?command=delta-import&clean=false&commit=ture (dataimport.properties)
http://wiki.apache.org/solr/DataImportHandler
6 Commands example
7 Scheduling and dataimport.properties.xml
/lib/apache-solr-dataimportscheduler.jar
Tomcat : /solr.war
<listener><listener-class> org.apache.solr.handler.dataimport.scheduler.ApplicationListener</listener-class></listener>
8 Query data - Solr administration Console
Analysis
DataImport
Try to query the data we feed to Solr
9 Advance Search- Edismax
&defType=Edismax
select/?q=video&defType=edismax&qf=features^20.0+text^0.3&bq=cat:electronics^5.0
10 Full exampleq=osce&start=0&rows=10&wt=xml&indent=false
&defType=edismax
&hl=true&hl.fl=Title%2CSegment%2CProblems%2CPublicContent
&hl.simple.pre=%3Cem%3E&hl.simple.post=%3C%2Fem%3E&hl.usePhraseHighlighter=true&hl.highlightMultiTerm=true
&facet=true&facet.query=osce
&facet.field=Segment,OperatingSystem
&spellcheck=true&spellcheck.build=true&spellcheck.reload=true
&spellcheck.q=oscc
&spellcheck.onlyMorePopular=true
&spellcheck.accuracy=0.7
11 Setup solrconfig.xml
Spell checking
Suggestion
List Terms of field
MLT – more like this
12 SolrJ
Library to connect and interact with Solr
13 Thank You!