SOLR 服务器每个文档的输出字段顺序
我目前正在运行一个大型元数据多面浏览器。 当文档从服务器输出时,我想影响每个文档的字段顺序。 这与 solr 配置中定义字段的顺序不同且不相关,也不与 solr 配置中填充字段的顺序相关。
作为一个具体示例,有一个字段在摄取之前直接链接到原始文件。我希望这个字段始终显示在文档的底部。 (如果只是这样,我就会破解它,但是同一文档中字段的相对顺序对于各种事物都很重要,例如,语言代码和语言名称应该彼此相邻,等等)
有人有吗一种使 solr 对文档中的字段进行排序的方法?
I am currently running a large-ish metadata faceted browser.
I would like to influence the order of the fields of each document as the document is output from the server.
This differs and does not correlate with the order the fields are defined in the solr config, nor with the order the fields are populated in the solr config.
As a concrete example, there is one field that links directly to the original file before ingestion. I would like to have this field always show up at the bottom of the document.
(if it was only this than I would just hack it, however the relative ordering of the fields within the same document matters for all kinds of things, e.g., language code and language name should be next to eachother, etc.)
Does anyone have a way of making solr order the fields in a document?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过使用 fl 参数 对字段进行排序?
Have you tried ordering fields with fl parameter?
如果您仍然遇到这个问题,我认为实现此目的的唯一方法是编写一个 solr 插件来为您完成此操作。
您需要使用所需的字段顺序构建自己的结果列表。
您可以扩展 Solr-Query-Component 并在 process 方法中调用 super() 后完成此工作。
在这里,您必须通过 SolrIndexSearcher (rb.req.getSearcher()) 从索引加载结果列表中每个文档的结果,并根据需要对字段进行排序。
问候雷内
if you still have this issue, i think the only way to achieve this is to write a solr-plugin which does this for you.
You'll need to build your own result-list with the field-order you need.
You can Extend the Solr-Query-Component and do this job after calling super() in the process method.
Here you have to load the results for each document in the result-list from the index via SolrIndexSearcher (rb.req.getSearcher()) and order the fields as you need.
greetings René