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 <ms@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


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.baril@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.baril@architextus.com




--
France Baril
Architecte documentaire / Documentation architect
france.baril@architextus.com