Adding sample documents to the Solr index
Let us push in some sample data into Solr. Go to <solr_dir>/example/exampledocs
. Execute the following commands to add all sample documents into our Solr index:
java -Durl=http://localhost:8080/solr/update -Dtype=application/csv -jar post.jar books.csv java -Durl=http://localhost:8080/solr/update -jar post.jar *.xml java -Durl=http://localhost:8080/solr/update -Dtype=application/json -jar post.jar books.json
To check how many documents have been indexed go to the following URL:
http://localhost:8080/solr/collection1/select/?q=*:*
This is a query to Solr that asks to return all the documents in the index. The numFound
field in the XML output specifies the number of documents in our Solr index.
We are working with the default schema. To check the schema, go to the following URL:
http://localhost:8080/solr/#/collection1/schema
The following screenshot shows the content of a sample schema file schema.xml
:
We can see that there are multiple fields: id...