Changes

Jump to navigation Jump to search
2,075 bytes added ,  14:18, 20 July 2022
no edit summary
This [[Module Library|XQuery Module]] provides functions for displaying information stored in the database index structures. All  For functions are introduced with that use the {{Monoindexes to return nodes see [[Database_Module#Value_Indexes|index:}} prefix, which is linked to Value Indexes]] in the statically declared [[Database Module]] and {{MonoFunction|Full-Text|httpft://basex.org/modules/indexsearch}} namespacein the [[Full-Text Module]].
=Conventions=
All functions share {{Mono|$db}} as argument, which may either reference a string, denoting and errors in this module are assigned to the name of the addressed database, or a node from an already opened database<code><nowiki>http://basex. The following errors may be raised by all functions: * org/modules/index<b/nowiki>[[XQuery Errors#BaseX Errors|BASX0001]]</bcode> namespace, which is raised if statically bound to the index required by a function is not available.* '''[[Database Module#Errors|BXDB0001]]''' is raised if {{MonoCode|$dbindex}} references a node that is not stored in a database (i.e., references a main-memory XML fragment).* '''[[Database Module#Errors|BXDB0002]]''' is raised if the addressed database cannot be openedprefix.<br/>
=Functions=
==index:facets==
 {|width='100%'|-| valign='"top' "| width='90120' | '''Signatures'''|{{MonoFunc|<b>index:facets</b>(|$db as item()) as xs:string|xs:string}}<br/>{{MonoFunc|<b>index:facets</b>(|$db as item()xs:string, $type as xs:string) as |xs:string}}|-| valign='"top' "| '''Summary'''|Returns information about possible all facets and facet values on a of the database {{Code|$db}} in document structure format.<br/>If {{MonoCode|$type}} is specified as {{MonoCode|flat}}, the function returns this information in a flat summarized version. The returned data is derived from the [[Indexes#Path Index|Path Index]].|-valign="top"| '''Errors'''|{{Error|db:get|Database Module#Errors}} The addressed database does not exist or could not be opened.|- valign='"top' "| '''Examples'''
|
* {{MonoCode|index:facets("DB")}} returns information about facets and facet values on the database {{MonoCode|DB}} in document structure.* {{MonoCode|index:facets("DB", "flat")}} returns information about facets and facet values on the database {{MonoCode|DB}} in a summarized flat structure.
|}
==index:texts==
 {|width='100%'|-| valign='"top' "| width='90120' | '''Signatures'''|{{MonoFunc|<b>index:texts|$db as xs:string|element(value)*}}<br/b>({{Func|index:texts|$db as item()) xs:string, $prefix as xs:string|element(value)*}}<br/>{{MonoFunc|<b>index:texts</b>(|$db as item()xs:string, $prefix start as xs:string) , $ascending as xs:boolean|element(value)*}}|-| valign='"top' "| '''Summary'''|Returns all strings stored in the text index[[Indexes#Text Index|Text Index]] of the database {{Code|$db}}, along with their number of occurrences.<br/>If {{MonoCode|$prefix}} is specified, the returned nodes entries will be refined to the strings ones starting with that prefix.<br/>If {{Code|$start}} and {{Code|$ascending}} are specified, all nodes will be returned after or before the specified start entry.|- valign="top"|'''Errors'''|{{Error|db:get|Database Module#Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|db:no-index|Database Module#Errors}} the index is not available.
|}
==index:attributes==
 {|width='100%'|-| valign='"top' "| width='90120' | '''Signatures'''|{{MonoFunc|<b>index:attributes|$db as xs:string|element(value)*}}<br/b>({{Func|index:attributes|$db as item()) xs:string, $prefix as xs:string|element(value)*}}<br/>{{MonoFunc|<b>index:attributes</b>(|$db as item()xs:string, $prefix start as xs:string) , $ascending as xs:boolean|element(value)*}}|-| valign='"top' "| '''Summary'''|Returns all strings stored in the attribute index[[Indexes#Attribute Index|Attribute Index]] of the database {{Code|$db}}, along with their number of occurrences.<br/>If {{MonoCode|$prefix}} is specified, the returned nodes entries will be refined to the strings ones starting with that prefix.<br/>If {{Code|$start}} and {{Code|$ascending}} are specified, all nodes will be returned after or before the specified start entry.|- valign="top"|'''Errors'''|{{Error|db:get|Database Module#Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|db:no-index|Database Module#Errors}} the index is not available.|} ==index:tokens== {| width='100%'|- valign="top"| width='120' | '''Signatures'''|{{Func|index:tokens|$db as xs:string|element(value)*}}|- valign="top"|'''Summary'''|Returns all strings stored in the [[Indexes#Token Index|Token Index]] of the database {{Code|$db}}, along with their number of occurrences.|- valign="top"|'''Errors'''|{{Error|db:get|Database Module#Errors}} The addressed database does not exist or could not be opened.<br/>{{Error|db:no-index|Database Module#Errors}} the index is not available.
|}
==index:element-names==
 {|width='100%'|-| valign='"top' "| width='90120' | '''Signatures'''|{{MonoFunc|<b>index:element-names</b>(|$db as item()) as xs:string|element(value)*}}|-| valign='"top' "| '''Summary'''|Returns all element names stored in the index[[Indexes#Name Index|Name Index]] of the database {{Code|$db}}, along with their number of occurrences.|- valign="top"|'''Errors'''|{{Error|db:get|Database Module#Errors}} The addressed database does not exist or could not be opened.
|}
==index:attribute-names==
 {|width='100%'|-| valign='"top' "| width='90120' | '''Signatures'''|{{MonoFunc|<b>index:attribute-names</b>(|$db as item()) as xs:string|element(value)*}}|-| valign='"top' "| '''Summary'''|Returns all attribute names stored in the index[[Indexes#Name Index|Name Index]] of the database {{Code|$db}}, along with their number of occurrences.|- valign="top"|'''Errors'''|{{Error|db:get|Database Module#Errors}} The addressed database does not exist or could not be opened.
|}
=Changelog=
The module was introduced with ;Version 8.4 * Added: {{Function||index:tokens}} ;Version7.7 * Updated: the functions no longer accept [[Database Module#Database Nodes|Database Nodes]] as reference. Instead, the name of a database must now be specified. ;Version 7.13 * Updated: {{Function||index:texts}}, {{Function||index:attributes}}: signature with three arguments added.
[[Category:XQuery]]The module was introduced with Version 7.1.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu