This Perl script re-indexes the whole database, which is located in the db/ directory

iviindex is both a CGI script and a console application.
There are no parameters to be passed to it.

iviindex recurses through the whole database (the db directory)
and rebuilds all index directories, so that the index directories
do not have to be archived, or to restore a clean situation after a crash.

The analyze function recurses through the built DOM tree, and implements it's own functions
like "<lowercase>SOMETHING BIG</lowercase>" which results to "something big" ...

The IVI-Index-Language looks like the following:

<root xmlns:ivi="http://livingxml.net/2002/ivi">
 <index>
  <source><parameter name="Person/Vorname"><lowercase><xsl:value-of select="Person/Vorname"/></lowercase></parameter>_<parameter name="Person/Familienname"><lowercase><xsl:value-of select="Person/Familienname"/></lowercase></parameter>_<xsl:value-of select="\$id"/></source>
  <destination>../test/<xsl:value-of select="\$id"/></destination>
 </index>
</root>

The first processing step is to run the Index-Definition against the XML document, that has to be indexed.
The resulting XML can contain several <index> elements.
All those <index> elements have to consist of two parts, the source and the destination.
The source defines which fields of the XML document have to be indexed.
The destination defines where the index should point to. 
This is necessary, so that it is possible to index references to other XML documents in other tables.

The source is a concatination of several parameters:

Simple index of the firstname and the surname of an address table:

firstname_surname_id -> ../adr/id

So that you can search for all persons with the firstname "Petr", you can do:

ls Petr_*_*


You could also generate a mass of indexes to one file

<root xmlns:ivi="http://livingxml.net/2002/ivi">
 <xsl:for-each select="addresses/adress">
  <index>
   <source><parameter name="Person/Vorname"><lowercase><xsl:value-of select="Person/Vorname"/></lowercase></parameter>_<parameter name="Person/Familienname"><lowercase><xsl:value-of select="Person/Familienname"/></lowercase></parameter>_<xsl:value-of select="\$id"/></source>
   <destination>../test/<xsl:value-of select="\$id"/></destination>
  </index>
 </xsl:for-each>
</root>



