GlennRicaud / data-toolbox-app

Apache License 2.0
10 stars 1 forks source link

Using Data Toolbox to query for use of certain part config values #32

Closed Bellfalasch closed 3 years ago

Bellfalasch commented 3 years ago

Help Glenn! =)

So I'm interesting in querying our large dataset for existing of some outdated data. The thing is we change the data structure from time to time and that means the old data is still stored in XP but not possible to extract from within Content Studio's forms. But how do we query for component data in the Data Toolbox (or

One example is I have a Part called teaser that can be placed to any page, this will add the following search path to the content - page.regions.main.components[] with an object within. But how do I write a query to find all uses of a particular part, like one called 'teaser'. I would imagine the start is this:

page.regions.main.components.descriptor LIKE '*:teasers'

but since components is an array and not flat I get no matches. Changing to this doesn't work:

page.regions.main.components[].descriptor LIKE '*:teasers'

Also, finding all uses of one particular part is great, but would also need to expand that query to check for particular configs (that we are looking into removing if they are not used, but must make sure first).

page.regions.main.components.config.reverseSize LIKE '*'

GlennRicaud commented 3 years ago

I will suppose that we are talking about XP 7.0 or superior:

One thing very confusing is that the representation of components at content level and node level is different since 7.0. That is creating a lot of confusion.

From ContentViewer or the content-lib, it is true that the parts are represented in this tree view: page.regions.main.components.**

Screen Shot 2020-11-15 at 13 36 05

But in reality at the node the structure has changed since 7.0 and they are all in the same array "components" (Screenshot 2)

Screen Shot 2020-11-15 at 13 40 48

You can actually see what is index / how you can search by clicking on the button:

Screen Shot 2020-11-15 at 13 42 00

And see there how it is actually indexed:

Screen Shot 2020-11-15 at 13 42 26

So in DT, to search for content with a component with a specific descriptor it would be the following query:

Screen Shot 2020-11-15 at 13 42 42
Bellfalasch commented 3 years ago

Oh my G.. you are such a genious! Thanks so much for the elaborate response, I can totally see how it works now and still understand how Content Viewer tricked me. I should have used the Toolbox to explore instead!