简体   繁体   English

Solr:创建一个具有多个值的默认值的multiValued字段吗?

[英]Solr: create a multiValued field with a default that has multiple values?

In my Solr schema, I want to create a multiValued field and set multiple values per default. 在我的Solr模式中,我想创建一个multiValued字段,并默认设置多个值。 Possible values are eg A , B and C . 可能的值为例如ABC Can I just set some of them as a comma-separated list? 我可以将其中一些设置为逗号分隔的列表吗?

What I'd like to do is: 我想做的是:

<field ...
       multiValued="true" 
       default="A,B"/>

Is this the right way? 这是正确的方法吗? Unfortunately I couldn't find any hints in the official documentation. 不幸的是,我在官方文档中找不到任何提示。

I have tried many different ways by playing with schema but it seems like you cant put multiple default values by using schema only. 我通过玩模式尝试了许多不同的方法,但是似乎您不能仅通过使用模式来放置多个默认值。 The syntax that you wrote makes your multivalued field have a single entry like 您编写的语法使多值字段具有单个条目,例如

<str>A,B</str>

which is not useful.. 这没用..

As there is no documentation about it i would recommend you to check here - which you have probably checked before 由于没有相关文档,我建议您在这里进行检查-您之前可能已经检查过

You can try to hack solr source code to handle multiple default values on schema.. it could be also painful too, as the documentation is not that well even for the code itself, but i think it is possible to do.. 您可以尝试破解solr源代码以处理架构上的多个默认值。这也可能很痛苦,因为即使对于代码本身,该文档也不是很好,但是我认为这是可以做到的。

ps because i cant comment under your question i had to write this as answer ps,因为我无法在您的问题下发表评论,因此我不得不将其写为答案

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

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