Now that we have prepared the system and installed Solr, we are ready to post some example data as suggested by the default tutorial. In order to check if our installation is working as expected, we need to perform the following steps:
/example/exampledocs
folder of our Solr installation. First of all, we move to that directory using the following command:>> cd %SOLR_DIST% (windows) >> cd $SOLR_DIST (linux, mac)
post.jar
library provided, using the following command:>> java -jar post.jar .
/example/exampledocs
subfolder, you can find some documents written using the XML, CSV, or JSON format that Solr recognizes to index the data. The post.jar
Java library is designed to send every file contained in a directory (in this case, the current directory). This library is written in one of these formats to a running Solr instance, in this case the default one. The data is sent by an HTTP POST request, and this should explain the name.json
format. The example data describes items in a hypothetical catalog of electronic devices.As you can see in the screenshot, the results are recognizable as items inside a docs collection; we can see the first, which has both fields containing a single value or multiple values (these are easily recognizable by the [ , ]
JSON syntax for lists). The header section of the results contains some general information. For example, the query sent (q=*:*
, which basically means "I want to obtain all the documents") and the format chosen for the output (in our case JSON). Moreover, you should note that the number of results is 32
, which is bigger than the number of files in that directory. This should suggest to us that we send more than one single document in a single post (we will see this in the later chapters).
Lastly, you can see in the address that we are actually querying over a subpath called collection1
. This is the name of the default collection where we have indexed our example data. In the next chapter, we will start using our first collection instead of this example one.
18.218.78.102