简体   繁体   English

Solr多值字段字符串

[英]Solr Multivalued fields to string

I have a SOLR instance which is fed from a 3rd party application and one of the fields is multivalued and returns like Below 我有一个由第三方应用程序提供的SOLR实例,并且其中一个字段是多值的,并且返回如下所示

<arr name="site_code">
      <str>4A</str>
      <str>R3</str>
      <str>UK</str>

However another requirment is for the application to display the values as a comma separated list 4A,R3,UK. 但是,对于应用程序,另一个要求是将值显示为以逗号分隔的列表4A,R3,UK.

I have tried to create a copyfield from site_code into a field call site_code_csv but it doesnt work. 我试图创建一个从site_code到字段调用site_code_csv的copyfield,但是它不起作用。 Is there a way this can be done? 有办法吗?

thanks 谢谢

Andy 安迪

To get information out of Solr in the format 4A,R3,UK you can simply change the output format in Solr for your individual query: 要以4A,R3,UK格式从Solr中获取信息4A,R3,UK您可以简单地在Solr中为您的单个查询更改输出格式:

Add wt=csv (wt is "writer type/response format") to your query. wt=csv (wt是“作者类型/响应格式”)添加到您的查询中。

Documentation: http://wiki.apache.org/solr/CSVResponseWriter 文档: http : //wiki.apache.org/solr/CSVResponseWriter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM