Re: Need help on aggregation of nested documents

2021-11-16 Thread Gopal Sharma
I have created a custom Collector extending SimpleCollector. I can see the methods scoreMode() and collect(int doc). I am seeing that the collect method is invoked by lucene with the child docId. Am I moving in the right direction? But to collect the values I would need the Document by using read

Re: Need help on aggregation of nested documents

2021-11-16 Thread Adrien Grand
Indeed you shouldn't load all hits, you should register a org.apache.lucene.search.Collector that will aggregate data while matches are being collected. Since you are already using a ToChildBlockJoinQuery, you should be able to use it in conjunction with utility classes from lucene/facets. Have yo

Re: Need help on aggregation of nested documents

2021-11-15 Thread Gopal Sharma
Hi Adrien, Thanks for the reply. I am able to retrieve the child docId's using the .ToChildBlockJoinQuery. Now for me to do aggregates i need to find the document using reader.document(int docID) right?. If that is the case won't getting all the documents would be a costly operation and then fina

Re: Need help on aggregation of nested documents

2021-11-15 Thread Adrien Grand
It's not straightforward as we don't provide high-level tooling to do this. You need to use the BitSetProducer that you pass to the ToParentBlockJoinQuery in order to resolve the range of child doc IDs for a given parent doc ID (see e.g. how ToChildBlockJoinQuery does it), and then aggregate over t

Need help on aggregation of nested documents

2021-11-14 Thread Gopal Sharma
Hi Team, I have a document structure as a customer which itself has few attributes like gender, location etc. Each customer will have a list of facts like transaction, product views etc. I want to do an aggregation of the facts. For example find all customers who are from a specific location and