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 <ibla...@binovo.es.invalid> 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> > > ibla...@binovo.es <mailto:ibla...@binovo.es> > > 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/> > -- Sincerely yours Mikhail Khludnev https://t.me/MUST_SEARCH A caveat: Cyrillic!