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
类型的字段并将 stored
属性设置为 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屋!