Hi Norbert,

The field name in collection2 is  "reporting_to" not "reporting".

Dominique



Le mer. 12 août 2020 à 11:59, Norbert Kutasi <kutasi.norb...@gmail.com> a
écrit :

> Hello,
>
> We have been using [subquery] to come up with arbitrary complex hierarchies
> in our document responses.
>
> It works well as long as the documents are in the same collection however
> based on the reference guide I infer it can bring in documents from
> different collections except it throws an error.
>
> https://lucene.apache.org/solr/guide/8_2/transforming-result-documents.html#subquery
>
>
> We are on SOLR 8.2 and in this sandbox we have a 2 node SOLRCloud cluster,
> where both collections have 1 shard and 2 NRT replicas to ensure nodes have
> a core from each collection.
> Basic Authorization enabled.
>
> Simple steps to reproduce this issue in this 2 node environment:
> ./solr create -c Collection1 -s 1 -rf 2
> ./solr create -c Collection2 -s 1 -rf 2
>
> Note: these collections are schemaless, however we observed the ones with
> schemas.
>
> Collection 1:
> <add>
>    <doc>
>       <field name = "id">1</field>
>       <field name = "first name">John</field>
>    </doc>
>    <doc>
>       <field name = "id">2</field>
>       <field name = "first name">Peter</field>
>    </doc>
> </add>
>
> Collection 2:
> <add>
>    <doc>
>       <field name = "id">3</field>
>       <field name = "first name">Thomas</field>
>  <field name = "reporting_to">2</field>
>    </doc>
>    <doc>
>       <field name = "id">4</field>
>       <field name = "first name">Charles</field>
>       <field name = "reporting_to">1</field>
>    </doc>
>    <doc>
>       <field name = "id">5</field>
>       <field name = "first name">Susan</field>
>  <field name = "reporting_to">3</field>
>    </doc>
> </add>
>
>
> http://localhost:8983/solr/Collection1/query
> {
>   params: {
>     q: "*",
>     fq: "*",
>     rows: 5,
> fl:"*,subordinate:[subquery fromIndex=Collection2]",
>     subordinate.fl:"*",
>     subordinate.q:"{!field f=reporting v=$row.id}",
>     subordinate.fq:"*",
>     subordinate.rows:"5"
>   }
> }
>
> {
>   "error":{
>     "metadata":[
>       "error-class","org.apache.solr.common.SolrException",
>       "root-error-class","org.apache.solr.common.SolrException"],
>     "msg":"while invoking subordinate:[subqueryfromIndex=Collection2] on
>
> doc=SolrDocument{id=stored,indexed,tokenized,omitNorms,indexOptions=DOCS<id:1>,
> first_name=[stored,index",
>     "code":400}}
>
>
> Where do we make a mistake?
>
> Thank you in advance,
> Norbert
>

Reply via email to