Hi Mikhail,

Thanks for your response. It worked and I think that it put me on the right path but I'm still a bit confused

I thought that blockChain allowed me to change the domain to all the children of the main resulting documents and that the "id:DIC*" filter would limit the children in the domain to those whose id starts with DIC, which are only the dictionary ones.

But after trying your suggestion, rereading the doc and thanks to your pointer I start to understand that what I have to provide to blockChildren is the query to get the parent documents.  I've come with something like this:

 "blockChildren":"-_nest_path_:*"

It seems to work.

But in my case this works because I only have "lang_ids" field in the dictionary subdocuments... but what if this field was also present in other subdocuments? Is there a way to reduce the new domain to only the children's that comply to some kind of filter?

Thanks a lot.



El 4/5/23 a las 10:58, Mikhail Khludnev escribió:
Hello Igor.
I'm not sure parent/child docs are indexed well in this particular case.
But I spot one detail in the ref guide ...  exclusively matches all parent
documents in the collection.
Presumably it should be  "blockChildren":"id:[0 TO 9]"
Beforehand, check that this query matches only parent documents.

On Thu, May 4, 2023 at 10:14 AM Igor Blanco<[email protected]>
wrote:

I have a document with nested documents indexed as this:

{

      'id':1,
      'creation_date':'2023-02-09T07:18:59Z',
      'update_date':'2023-05-03T14:37:08Z',
      'dictionary':{
          'id':'DIC1',
          'lang_ids':[
              2,
              3
          ]
      },
      'contexts':[
      ],
      'definitions':[
          {
              'id':'DFN1',
              'lang_id':2,
              'definition':'<p>una definición</p>'
          }
      ],
      'denominations':[
          {
              'id':'DNM1',
              'lang_id':2,
              'denomination':'Casa',
              'feminine_form':'no procede',
              'masculine_form':'no procede'
          }
      ],
      'illustrations':[
      ],
      'notes':[
      ],
      'observations':[
      ],
      'videos':[
      ]

}


I want to find that document and a facet that lists each of the lang_ids
in the dictionary subdocument.

So I try a query like this:


http://0.0.0.0:8983/solr/index_cards/select?facet=true&indent=true&json.facet=%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22working_language_ids%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22domain%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22blockChildren%22%3A%22id%3ADIC*%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22terms%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22field%22%3A%20%22lang_ids%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22limit%22%3A%20-1%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D&q.op=OR&q=id%3A1&useParams=


     q parameter is => id:1

     json.facet parameter is =>

     {
                      "working_language_ids": {
                          "domain": {
                             "blockChildren":"id:DIC*"
                         },
                          "type": "terms",
                          "field": "lang_ids",
                          "limit": -1
                      }
                  }

The result returns the expected parent document, but
working_language_ids facet is empty:

"facets":{
      "count":1,
      "working_language_ids":{
        "buckets":[]}}


If i query directly "id:DIC*" and get the dictionary subdocuments
instead of the parent and ommit the "domain" section of the facet it
returns the expected result, so the problem does not seem to be in the
in the indexing of lang_ids itself nor in the facet definition, but most
probably in the use of "blockChildren".

Any clue will be much appreciated, thanks.


--


       IgorBlanco

Director desarrollo a medida | Neurrirako garapenen zuzendaria

Binovo IT Human Project




         943 569 206<tel:943 569 206>  | 690229375<tel:690229375>

         [email protected]  <mailto:[email protected]>

         binovo.es <//binovo.es>

         Astigarragako Bidea, 2 - 2º izda. Oficina 10-11, 20180 Oiartzun





youtube<https://www.youtube.com/user/CANALBINOVO/>
         linkedin< https://www.linkedin.com/company/binovo-it-human-project/>


--


     IgorBlanco

Director desarrollo a medida | Neurrirako garapenen zuzendaria

Binovo IT Human Project




        943 569 206 <tel:943 569 206> | 690229375 <tel:690229375>

        [email protected] <mailto:[email protected]>

        binovo.es <//binovo.es>

        Astigarragako Bidea, 2 - 2º izda. Oficina 10-11, 20180 Oiartzun




        
youtube <https://www.youtube.com/user/CANALBINOVO/>       
        linkedin <https://www.linkedin.com/company/binovo-it-human-project/>    
  

Reply via email to