Hi everybody!

/I described a bit what I found in another thread, but I prefer to create a new thread for this specific question.../
*It's **possible to create an array of string by doing (incomplete example):
- in the data-conf.xml:*
<entity name="solr_articles" query="select title, abstract from articles">

   <entity name="authors_array" query="select given_name, last_name
   from authors WHERE article_id='${solr_articles.id}'">
     <field column="title" name="title" />
     <field column="abstract" name="abstract" />
     <field column="given_name" name="given_name" />
     <field column="last_name" name="last_name" />
   </entity>

</entity>

*- in schema.xml:
*<field name="title" type="string" indexed="false" stored="true" required="false" multiValued="true" /> <field name="abstract" type="string" indexed="false" stored="true" required="false" multiValued="true" /> <field name="given_name" type="string" indexed="false" stored="true" required="false" multiValued="true" /> <field name="last_name" type="string" indexed="false" stored="true" required="false" multiValued="true" />

And this provides something like:

"docs":[
      {
[...]
        "given_name":["Bastien",          "Matthieu",          "Nino"],
        "last_name":["lastname1",         "lastname2",         "lastname3",           
"lastname4"],

[...]


*Note: there can be one author with only a last_name, and then we are unable to tell which one it is...*

My goal would be to get this as a result:

"docs":[
      {
[...]
   "authors_array":
    [   
        [
        "given_name":["Bastien"],
        "last_name":["lastname1"]
        ],
        [
        "last_name":["lastname2"]
        ],
        [
        "given_name":["Matthieu"],
        "last_name":["lastname2"]
        ],
        [
        "given_name":["Nino"],
        "last_name":["lastname4"]
        ],
    ]
[...]


Is there any way to do this?
/PS: I know that I could do '//select if(a.given_name is not null, a.given_name ,'') as given_name, [...]//' but I would like to get an array.../

I tried to add something like that to the schema.xml, but this doesn't work (well, it might be of type 'array'): <field name="authors_array" type="string" indexed="true" stored="true" required="false" multiValued="true"/>

Kind regards,
Bastien Latard
Web engineer
--
MDPI AG
Postfach, CH-4005 Basel, Switzerland
Office: Klybeckstrasse 64, CH-4057
Tel. +41 61 683 77 35
Fax: +41 61 302 89 18
E-mail:
lat...@mdpi.com
http://www.mdpi.com/

Reply via email to