Solr return file name

2020-05-07 03:58发布

问题:

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

回答1:

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



标签: solr indexing