With GraphQL I am requesting all children() from my commit object, which thus should include all the objects in the model. So far it seemed to work and I never questioned it.
But in one of my cases, the totalCount property says there would be 20380 children, but I actually only receive 19363.
I tried different limits like 90000 or smaller and then using cursors. I also tried different depths (although I already learned to just leave it away). I am always missing the same amount of children. Apparently, I donât really know whatâs missing, but I know that at least a referenced material is missing (thatâs how I noticed). If I am querying that material directly, I receive it as expected.
What could be the reasons for that?
Thanks in advance!
PS: The model is coming from Revit and my query looks like that:
Good catch on this! Iâd suggest introducing a depth parameter to the children() query and removing the cursor for now to see if that makes a difference.
Adding depth:
Speckleâs GraphQL API has depth-based traversal, meaning some deeply nested objects might not be included unless explicitly requested.
While the default depth usually works, setting it explicitly (e.g., depth: 10) can help ensure all expected children are retrieved.
You can experiment with different values: 10 or 50 should be more than enough, while something extreme like 10000 might be overkill or even restricted.
Indeed reducing depth can aso be desirable in certain circumstancaes as another data payload reduction measure.
Removing cursor:
If youâre fetching everything in one go, leaving cursor empty shouldnât be necessary.
We can always bring it back later if pagination turns out to be a desirable feature.
In short, the depth seems buggy - especially the depth of 10 (in the other postâs project/query, but also in the current project). The 10 results in very, very few results (same problem as in the other post):
Nevertheless, I did experiment with the depth and increased it step by step. In my current case it behaved reasonable, and there is no increase in received elements for depth 7, 8, 9.
What else Iâve tried by now:
I wanted to reduce the amount of received elements right from the beginning, to maybe avoid problems with high number of elements. ⌠and just to try something else. Using a query for filtering only elements with a materialQuantities property has been a little tricky (since you havenât implemented anything for testing null or empty arrays or array lengths), but it seems to work. I made a separate query for receiving all materials, which only returns 32 materials⌠sadly the missing material still isnât among them.
As I said, I can receive the missing materials if I request it directly, and the material doesnât really seem to be any different than any other material.
Requesting potentially missing materials seperately (although they still shouldnât be missing in the first place), might even be âoooâŚkaaayâ.
But Iâm actually even more worried about the other 1000 missing objects, which I wonât be able to notice.
I was thinking, âHow can I help Steffen debug this without access to the source material?â depth was first came to mind but if you are saying it has no effectâŚ