XML Query Indexes
xindex.xml is a comet XML configuration file to speed up XML queries via an indexes in comet scripting.
The following recommendations apply if...
- you use the standard XML data structure for product data
- and XmlQuery is your preferred query language (opposed to XPath)
Then we recommend to set special index to optimize XML Query lookups.
The standard XML data structure is described in
- In the file
xindex.xmlan index is needed on node pathdata.item.item.idfor the file$DATAFILE - In the file
xentities.xmla type definition is needed foridfor the file$DATAFILE(must be of type string).
xindex.xml
xindex.xml is a comet XML configuration file to speed up XML queries (defining indexes) in comet scripting.
<indicees>
<!-- Standard indexes -->
<index>
<file>panelstatements.xml</file>
<nodepath>panelstatements.panelstatement.id</nodepath>
<unique>no</unique>
<enabled>yes</enabled>
</index>
<index>
<file>actions.xml</file>
<nodepath>actions.action.classid</nodepath>
<unique>no</unique>
<enabled>yes</enabled>
</index>
<index>
<file>pageitems.xml</file>
<nodepath>pageitems.pageitem.id</nodepath>
<unique>yes</unique>
<enabled>yes</enabled>
</index>
<index> <!-- Index on products.xml -->
<file>$DATAFILE</file>
<nodepath>data.item.item.id</nodepath>
<unique>yes</unique>
<enabled>yes</enabled>
</index>
</indicees>
In the default case we only need the last entry as an index of the products.xml represented in the datafiles.xml file as DATAFILE alias. If you do not see any performance improvements in XML query you can delete this entry.
xentities.xml
In xentities.xml we can define data types of attributes in the XML files. If, in your project, “id” attribute appears as a string in the xml file, you must define it in this file (see the last typedef entry in the example XML structure). In another case (as default behaviour) comet uses all “id” fields in the XML Query as integers. This can cause very strange problems which are hard to recognise, especially in the placeholder load scripts.
<entities>
<entity>
<file></file>
<search><br></search>
<replace> </replace>
</entity>
<typedef>
<file></file>
<attr>ProductGroupID</attr>
<type>int</type>
</typedef>
<typedef>
<file>framerules.xml</file>
<attr>distance</attr>
<type>float</type>
</typedef>
<!-- In most cases id field in product.xml is a string,
so we have to define this field as a string.
All fields without type definition comet will be considered as an integer
-->
<typedef>
<file>$DATAFILE</file>
<attr>id</attr>
<type>string</type>
</typedef>
</entities>