How to Index Data in Solr
The exampledocs directory contains samples of the types of instructions Solr expects, as well as a java utility for posting them from the command line (a post.sh shell script is also available, but for this tutorial we’ll use the cross-platform Java client).
To try this, open a new terminal window, enter the exampledocs directory, and run “java -jar post.jar” on some of the XML files in that directory, indicating the URL of the Solr server:
chrish@asimov:~/solr/example/exampledocs$ java -jar post.jar solr.xml monitor.xml SimplePostTool: version 1.2 SimplePostTool: WARNING: Make sure your XML documents are encoded in UTF-8, other encodings are not currently supported SimplePostTool: POSTing files to http://localhost:8983/solr/update.. SimplePostTool: POSTing file solr.xml SimplePostTool: POSTing file monitor.xml SimplePostTool: COMMITting Solr index changes..
You have now indexed two documents in Solr, and committed these changes. You can now search for “solr” using the “Make a Query” interface on the Admin screen, and you should get one result. Clicking the “Search” button should take you to the following URL…
http://localhost:8983/solr/select/?stylesheet=&q=solr&version=2.1&start=0&rows=10&indent=on
You can index all of the sample data, using the following command (assuming your shell supports the *.xml notation):
chrish@asimov:~/solr/example/exampledocs$ java -jar post.jar *.xml SimplePostTool: version 1.2 SimplePostTool: WARNING: Make sure your XML documents are encoded in UTF-8, other encodings are not currently supported SimplePostTool: POSTing files to http://localhost:8983/solr/update.. SimplePostTool: POSTing file hd.xml SimplePostTool: POSTing file ipod_other.xml SimplePostTool: POSTing file ipod_video.xml SimplePostTool: POSTing file mem.xml SimplePostTool: POSTing file monitor.xml SimplePostTool: POSTing file monitor2.xml SimplePostTool: POSTing file mp500.xml SimplePostTool: POSTing file sd500.xml SimplePostTool: POSTing file solr.xml SimplePostTool: POSTing file spellchecker.xml SimplePostTool: POSTing file utf8-example.xml SimplePostTool: POSTing file vidcard.xml SimplePostTool: COMMITting Solr index changes..
you can also grab the RSS feed or Subscribe to Techgurulive by Email
Not Getting
Some times when you change the schema of Solr, you have to re index the entire database in Solr Server. This can be achieved in a systematic manner. First you...
To start solr on Linux just go to the the example folder of sole and run java -jar start.jar . see the below given example /apache-solr-1.2.0/example/ [root@pss2 example]# java -jar...
































