I'm trying to get started with Apache Solr, but some things are not clear to me. Reading through the tutorial , I created a running instance of Solr. I am confused that the entire Solr configuration (schemas, etc.) is in XML format. When they add sample data, it shows how to add XML documents ( java -jar post.jar solr.xml monitor.xml
). Is this just a poor selection of sample format? I mean, do they upload data describing documents, or are the actual documents they add are .xml files?
I am trying to add some books in .txt format, so if I use java -jar post.jar mydoc.txt
, do I add it? How can I add this document and metadata (author, title) about it?
However, I tried to create a simple Html page to send documents to Solr:
<html> <head></head> <body> <form action="http://localhost:8983/solr/update?commit=true" enctype="multipart/form-data" method="post"> <input type="file"> <input type="submit" value="Send"> </form> </body> </html>
When I try to publish a file, I get this answer:
<response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">26</int> </lst> </response>
It is right? Does this mean that I have successfully added the file? If so, one of the words in the file, for example, "montagna" (this is an Italian book, montagna means mountain ...). If I find the url
http://localhost:8983/solr/select/?q=montagna&start=0&rows=10&indent=on
I expect something to be returned (maybe all the text or some information about the file), but this is what I get:
<response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">1</int> <lst name="params"> <str name="indent">on</str> <str name="start">0</str> <str name="q">montagna</str> <str name="rows">10</str> </lst> </lst> <result name="response" numFound="0" start="0"/> </response>
Not like coincidence with me. Also, according to this answer , I should be able to return the text associated with the match with hl.fragsize
. How to integrate this into the search bar? Thanks you