Hi Eliot -
If I'm following correctly, could you use `index:facets()`? E.g.
index:facets($db)//attribute[@name='bundles']//entry/text() => distinct-values()
Can the bundles attribute have multiple tokens? Best, Bridger
On Sat, Aug 6, 2022 at 12:01 PM Eliot Kimber eliot.kimber@servicenow.com wrote:
Using the attribute index I can get all attributes of a specific name that have a specific value or token (db:attribute()) and I can get all the values for all attributes that start with a specific prefix (index:attributes()) but I don’t see a way to get, from the index, all the values for all the attributes of a specific name.
Have I missed something?
My use case is I have an index over my docs where each index entry is of the form:
<doc-to-bundle-index-entry key="10503999" filename="c_DataCertification.dita" dbpath="product/data-certification/concept/c_DataCertification.dita" bundles="bundle-platcap-platform-capabilities"/>
And I would like the distinct-values of all the @bundles attributes. There are about 40K entry elements.
Of course I can do:
doc-to-bundle-index/doc-to-bundle-index-entry/@bundles ! tokenize(., '\s+')
=> distinct-values()
And that seems plenty fast, but it seemed like there should be a way to do it with the indexes alone. But it may be that the query on the @bundle attribute actually uses the index anyway…
Cheers,
E.
*Eliot Kimber*
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com https://www.servicenow.com
LinkedIn https://www.linkedin.com/company/servicenow | Twitter https://twitter.com/servicenow | YouTube https://www.youtube.com/user/servicenowinc | Facebook https://www.facebook.com/servicenow