I am not sure about your data exactly, but, the element hierarchy can be preserved: > (: http://files.basex.org/xml/factbook.xml :) > index:facets('factbook')//element[@name="continent"]/attribute[@name="id“] Will return only the id values of elements named continent :-)
Or in your example you might want to change this to „element[@name='country‘]“ One thing to consider, the maximum number of distinct-values that will be added to the index is defined by the maxcats option: http://docs.basex.org/wiki/Options#MAXCATS Best Michael > Am 12.06.2019 um 16:48 schrieb France Baril <france.ba...@architextus.com>: > > But facets would return @type values for all @type and I need only those on > <account>. > > On Wed, Jun 12, 2019 at 4:34 PM Michael Seiferle <m...@basex.org > <mailto:m...@basex.org>> wrote: > Hi France, > > that’s just a wild guess, but maybe the index:facets() might be of help here? > It works directly on the index information, so the queries should be > sufficiently fast if the results of index:facets() fulfill your needs. > > http://docs.basex.org/wiki/Index_Module#index:facets > <http://docs.basex.org/wiki/Index_Module#index:facets> > > > The idea of db:attribute-values() is an idea worth discussing as well. > > Best from Konstanz > > Michael > > > >> Am 12.06.2019 um 09:07 schrieb France Baril <france.ba...@architextus.com >> <mailto:france.ba...@architextus.com>>: >> >> Hi, >> >> I have been implementing more queries that use the attribute indexes lately. >> However a lot of my queries require getting values to offer selectable items >> in user forms (GUI). I have not found a good way to do that. >> >> For example, I tried changing : >> let $account-types := distinct-values(db:open($db-name)//account/@type) >> to >> let $account-types := distinct-values(db:attribute-range($db-name, 'a', >> 'zzzzzzzzzz', 'type')[parent::*/name() = 'account']) >> >> I looked for a function that would be more like >> let $account-types := db:attribute-values($db-name, >> 'type')[parent::*/name() = 'account] >> >> I'm not getting any performance improvements with the db:attribute-range >> compared to the regular db:open($db-name). and I am assuming that the issue >> is that since I provide a range, it has to check every value individually as >> opposed to just grabbing everything in the named attribute. >> >> Any chance we can get values at some point? Or do you have a suggestion to >> improve this type of query? >> >> >> >> >> -- >> France Baril >> Architecte documentaire / Documentation architect >> france.ba...@architextus.com <mailto:france.ba...@architextus.com> > > > > -- > France Baril > Architecte documentaire / Documentation architect > france.ba...@architextus.com <mailto:france.ba...@architextus.com>