This README guides you through creating a Solr-powered search engine for your own set of files including Word documents, PDFs, HTML, and many other supported types.
For further explanations, see the frequently asked questions at the end of the guide.
bin/solr start
Waiting to see Solr listening on port 8983 [/] Started Solr server on port 8983 (pid=<your pid>). Happy searching!
bin/solr create -c files -d example/files/conf
Now you’ve created a core called “files” using a configuration tuned for indexing and querying rich text files.
You should see the following response:
Creating new core 'files' using command: http://localhost:8983/solr/admin/cores?action=CREATE&name=files&instanceDir=files { "responseHeader":{ "status":0, "QTime":239}, "core":"files"}
bin/post -c files ~/Documents
<some number> files indexed. COMMITting Solr index changes to http://localhost:8983/solr/files/update... Time spent: <some amount of time>
bin/post -h
Your document information can be viewed in multiple formats: XML, JSON, CSV, as well as a nice HTML interface.
To view your document information in the HTML interface view, adjust the URL in your address bar to http://localhost:8983/solr/files/browse
To view your document information in XML or other formats, add &wt (for writer type) to the end of that URL. i.e. To view your results in xml format direct your browser to: http://localhost:8983/solr/files/browse?&wt=xml
Another way to verify that your core has been created is to view it in the Admin User Interface.
To access the Admin UI, go to your browser and visit : http://localhost:8983/solr/
On the left-hand side of the home page, click on “Core Selector”. The core you created, called “files” should be listed there; click on it. If it’s not listed, your core was not created and you’ll need to re-enter the create command.
Alternatively, you could just go to the core page directly by visiting : http://localhost:8983/solr/#/files
Now you’ve opened the core page. On this page there are a multitude of different tools you can use to analyze and search your core. You will make use of these features after indexing your documents.
Take note of the “Num Docs” field in your core Statistics. If after indexing your documents, it shows Num Docs to be 0, that means there was a problem indexing.
In the Admin UI, enter a term in the query box to see which documents contain the word.
You can filter the results by switching between the different content type tabs. To view an international version of this interface, hover over the globe icon in the top right hand section of the page.
Notice the tag cloud on the right side, which facets by top phrases extracted during indexing. Click on the phrases to see which documents contain them.
Another way to query the index is by manipulating the URL in your address bar once in the browse view.
Why use -d when creating a core?
How do I delete a core?
To delete a core (i.e. files), you can enter the following in your command shell:
bin/solr delete -c files
You should see the following output:
Deleting core ‘files’ using command:
http://localhost:8983/solr/admin/cores?action=UNLOAD&core=files&deleteIndex=true&deleteDataDir=true&deleteInstanceDir=true {"responseHeader":{ "status":0, "QTime":19}}
This calls the Solr core admin handler, “UNLOAD”, and the parameters “deleteDataDir” and “deleteInstanceDir” to ensure that all data associated with core is also removed
How can I change the /browse UI?
The primary templates are under example/files/conf/velocity. In order to edit those files in place (without having to re-create or patch a core/collection with an updated configuration), Solr can be started with a special system property set to the absolute path to the conf/velocity directory, like this:
bin/solr start -Dvelocity.template.base.dir=</full/path/to>/example/files/conf/velocity/
If you want to adjust the browse templates for an existing collection, edit the core’s configuration under server/solr/files/conf/velocity.