If you are really keeping inventory, use a relational database. Solr is a really poor choice for this kind of application.
wunder Walter Underwood wun...@wunderwood.org http://observer.wunderwood.org/ (my blog) > On May 24, 2019, at 6:12 AM, Mikhail Khludnev <m...@apache.org> wrote: > > It's possible to search for stocks filtering by M, sorting by qty, and then > parent docs need to be added to result list. > Unfortunately, there is no [parent] result transformer. Thus it can be done > with generic > https://lucene.apache.org/solr/guide/6_6/transforming-result-documents.html#TransformingResultDocuments-_subquery_ > . > > > On Fri, May 24, 2019 at 3:16 PM Gian Marco Tagliani <gm.tagli...@gmail.com> > wrote: > >> Hi all, >> I'm facing a problem with Nested Documents. >> >> To illustrate my problem I'll use the example with T-shirts in stock. >> For every model of a T-shirt, we can have different colors and sizes, for >> each combination we have the number of items in stock. >> >> In Solr, for every model we have a document, for every combination of color >> and size we have a nested child document. >> >> >> model A >> - color : red, size M, quantity 8 >> - color : blue, size L, quantity 4 >> - color : white, size M, quantity 1 >> >> model B >> - color yellow, size S, quantity 7 >> - color yellow, size M, quantity 3 >> >> model C >> - color red, size M, quantity 5 >> - color black, size L, quantity 6 >> >> >> I'm interested in size M only, and I want to know our stock ordered by >> quantity. >> >> model A, color red, quantity 8 >> model C, color red, quantity 5 >> model B, color yellow, quantity 3 >> model A, color white, quantity 1 >> >> >> >> My first idea was using the Json Nested Facet ( >> >> https://lucene.apache.org/solr/guide/json-facet-api.html#nested-facet-example >> ) >> In that case I'm not able to sort by quantity nor discriminate between the >> "color red" and "color white" lines for model A. >> >> My second idea was to use the Analytics Component ( >> https://lucene.apache.org/solr/guide/analytics.html) >> In this case I'm not able to get data from father and child document to >> build a facet. >> >> Has any of you encountered a similar problem? Do you have any idea on how >> to address my case? >> >> >> Thanks in advance >> Gian Marco Tagliani >> > > > -- > Sincerely yours > Mikhail Khludnev