-
Notifications
You must be signed in to change notification settings - Fork 18
Setting up for Solr
###Download and Install Solr
See the Solr download instructions here: http://lucene.apache.org/solr/downloads.html
We used Solr 5.5.1 for this tutorial. Download to ‘~/developer/’ and start the app:
cd ~/developer/solr-5.5.1
bin/solr start
In the browser:
###Create Core
bin/solr create -c qtest
###Add Field Type - No ASCII Filter
curl -X POST -H 'Content-type:application/json' --data-binary '{ "add-field-type" : { "name":"char_ngram", "class":"solr.TextField", "positionIncrementGap":"100", "indexAnalyzer" : { "tokenizer":{"class":"solr.StandardTokenizerFactory" }, "filters":[{"class":"solr.LowerCaseFilterFactory"}, {"class":"solr.EdgeNGramFilterFactory", "minGramSize":"1", "maxGramSize":"50"}] }, "queryAnalyzer" : { "tokenizer":{"class":"solr.StandardTokenizerFactory" }, "filters":[{"class":"solr.LowerCaseFilterFactory"}] } } }' http://localhost:8983/solr/qtest/schema
###Add Fields
curl -X POST -H 'Content-type:application/json' --data-binary '{ "add-field":{"name":"title_en", "type":"char_ngram","stored":true,"indexed":"true", "multiValued":"true"} }' http://localhost:8983/solr/qtest/schema
curl -X POST -H 'Content-type:application/json' --data-binary '{ "add-field":{"name":"title_sv", "type":"char_ngram", "stored":true, "indexed":"true", "multiValued":"true"} }' http://localhost:8983/solr/qtest/schema
Node: if you are using the out-of-the-box Solr core, you don’t need to add this default id field:
curl -X POST -H 'Content-type:application/json' --data-binary '{ "add-field":{"name":"id", "type":"string", "stored":true, "indexed":"true", "multiValued":"false"} }' http://localhost:8983/solr/qtest/schema
curl -X POST -H 'Content-type:application/json' --data-binary '{ "add-field":{"name":"query_testing_type", "type":"string", "stored":true, "indexed":"true", "multiValued":"false"} }' http://localhost:8983/solr/qtest/schema
###Add ASCII Filter (Only for Test 2)
curl -X POST -H 'Content-type:application/json' --data-binary '{ "replace-field-type" : { "name":"char_ngram", "class":"solr.TextField", "positionIncrementGap":"100", "indexAnalyzer" : { "tokenizer":{"class":"solr.StandardTokenizerFactory" }, "filters":[{"class":"solr.ASCIIFoldingFilterFactory"}, {"class":"solr.LowerCaseFilterFactory"}, {"class":"solr.EdgeNGramFilterFactory", "minGramSize":"1", "maxGramSize":"50"}] }, "queryAnalyzer" : { "tokenizer":{"class":"solr.StandardTokenizerFactory" }, "filters":[{"class":"solr.ASCIIFoldingFilterFactory"}, {"class":"solr.LowerCaseFilterFactory"}] } } }' http://localhost:8983/solr/qtest/schema