Schéma : configuration de l'index
Index : ensemble de documents
Document : ensemble de fields (champs)
http://www.solrtutorial.com/solr-in-5-minutes.html
# wget http://download.nextag.com/apache/lucene/solr/6.6.0/solr-6.6.0.tgz
# tar -zxvf solr-6.6.0.tgz
# cd solr-6.6.0
Java 1.8 pour la 6.6
Java 1.9 pour la 7.0
# bin/solr -e techproducts
Creating Solr home directory /tmp/solrt/solr-6.6.0/example/techproducts/solr
Starting up Solr on port 8983 using command:
bin/solr start -p 8983 -s "example/techproducts/solr"
Waiting up to 30 seconds to see Solr running on port 8983 [/]
Started Solr server on port 8983 (pid=12281). Happy searching!
...
Solr techproducts example launched successfully. Direct your Web browser to
http://localhost:8983/solr to visit the Solr Admin UI
# bin/solr status
Found 1 Solr nodes:
Solr process 12281 running on port 8983
{
"solr_home":"/tmp/solrt/solr-5.3.0/example/techproducts/solr/",
"version":"5.3.0 1696229 - noble - 2015-08-17 17:10:43",
"startTime":"2015-09-14T22:41:56.876Z",
"uptime":"0 days, 0 hours, 1 minutes, 7 seconds",
"memory":"32.7 MB (%6.7) of 490.7 MB"}
<add><doc>
<field name="id">13011994</field>
<field name="name">Sebtiz13</field>
<field name="manu">Internet</field>
...
<field name="inStock">true</field>
</doc></add>
# cd example/exampledocs
# java -Dc=techproducts -jar post.jar sd500.xml
SimplePostTool version 5.0.0
Posting files to [base] url http://localhost:8983/solr/techproducts/update using
content-type application/xml...
POSTing file sd500.xml to [base]
1 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/techproducts/update...
Time spent: 0:00:00.186
HTTP
Native client
{
"responseHeader": {
"status": 0,
"QTime": 3,
"params": {
"q": "sd500",
"wt": "json"
}
},
"response": {
"numFound": 1,
"start": 0,
"docs": [
{
"id": "9885A004",
"name": "Canon PowerShot SD500",
...
"_version_": 1512330534874775600
}
]
}
}
{
"responseHeader": {
"status": 0,
"QTime": 3,
"params": {
"fl": "id,name",
"q": "inStock:false",
"wt": "json"
}
},
"response": {
"numFound": 2,
"start": 0,
"docs": [
{
"id": "EN7800GTX/2DHTV/256M",
"name": "ASUS Extreme N7800GTX/2DHTV (256 MB)"
},
{
"id": "100-435805",
"name": "ATI Radeon X1900 XTX 512 MB PCIE Video Card"
}
]
}
}
title:foo
title:"foo bar"
title:foo*
price:1159
price:[419 TO 1159]
price:[* TO 1159]
price:[419 TO *]
price:[* TO *]
-inStock:false