0

I have indexed a couple of documents using solr, now when I perform a search using the admin interface, it returns search results in the XML format.

I am trying to figure out how can I associate a document that I have indexed example: test.pdf with the results that I receive and then serve that document to my user ?

Will solr return to me a unique ID of the document that I index, so that after indexing a document I can store the document along with that UID in my database somewhere and then when the user performs a search solr return the unique ID's of documents that match the search criteria and then I serve them from the database

oberfreak
  • 1,799
  • 13
  • 20

1 Answers1

2

You will need to add the filename as a stored field. Look at your schema.xml and make sure you declare a field of type string and set the stored attribute to true. By setting stored=true you will ensure that Solr can return the field back in results.

See this page for more information: http://wiki.apache.org/solr/SchemaXml

Cody Caughlan
  • 32,456
  • 5
  • 63
  • 68
  • I have added the following line to my schema.xml, and restarted solr. then posted a document solr.xml using post.jar, the document got posted successfully but still no field by the name filename is returned in the search – user1082214 Dec 05 '11 at 21:13
  • Are you making sure to ask for the field back, what does your "field list" `fl` parameter. See http://wiki.apache.org/solr/CommonQueryParameters – Cody Caughlan Dec 05 '11 at 21:27
  • And are you sure that you are WRITING to the field. What is `post.jar` and how does it know about your new field? – Cody Caughlan Dec 05 '11 at 21:28
  • ThIS may also be important http://wiki.apache.org/solr/ExtractingRequestHandler#Mapping_and_Capture . Use **literal.id** (generally literal.field_in_schema) to enter the id of your document. Then re-index those docs. – Jesvin Jose Dec 06 '11 at 14:41
  • thank you Cody, I was not sending in the filename field in my search query, rectified that and now things are working.. thanks again! – user1082214 Dec 06 '11 at 14:53
  • @aitchnyu , yes initially I was not adding the literal. keyword, almost tore my hair apart! – user1082214 Dec 06 '11 at 14:54