Solr返回文件名 [英] Solr return file name
问题描述
我使用solr索引了几个文档,现在当我使用管理界面执行搜索时,它会以XML格式返回搜索结果。
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.
我是试图找出如何将我索引的文档示例:test.pdf与我收到的结果相关联,然后将该文档提供给我的用户?
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 ?
将solr向我返回我索引的文档的唯一ID,以便在索引文档之后我可以将文档与该UID一起存储在我的数据库中,然后当用户执行搜索solr时返回匹配的文档的唯一ID搜索条件,然后我从数据库中提供它们
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
推荐答案
您需要将文件名添加为存储字段。查看 schema.xml
并确保声明 string
类型的字段并设置存储
属性为 true
。通过设置 stored = true
,您将确保Solr可以在结果中返回该字段。
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.
请参阅此页面更多信息: http://wiki.apache.org/solr/SchemaXml
See this page for more information: http://wiki.apache.org/solr/SchemaXml
这篇关于Solr返回文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!