Template Files
A template file specifies how the data returned from a database is structured for indexing into IDOL Server. You can create template files to customize how information from the database is transformed into IDOL documents.
NOTE: To retrieve information from sub-tables, you must create a template.
If you are not retrieving data from sub-tables, creating a template is optional. Without a template, the connector creates documents where the names of metadata fields match the names of the columns in the database.
The ODBC Connector runs the query defined in its configuration file, and uses the template to create a document for every row that is returned.
NOTE: The template must construct documents that conform to either IDX or Autonomy XML format.
The following is an example template file. Each HTML comment (<!--comment-->
) refers to a column name in the query results, and specifies that the information from that column should be inserted:
#DREREFERENCE <!--OrderID--> #DREFIELD OrderDate="<!--Date-->" #DREFIELD Customer="<!--CustomerID-->" #DREFIELD Status="<!--Status-->" #DRECONTENT Order information Date Received: <!--Date--> Status: <!--Status--> #DREENDDOC
A record retrieved from the table might produce the following IDX document:
#DREREFERENCE 012345 #DREFIELD OrderDate="16/10/2012 15:27:11" #DREFIELD Customer="2563" #DREFIELD Status="Order complete" #DRECONTENT Order information Date Received: 16/10/2012 15:27:11 Status: Order complete #DREENDDOC
As shown in the example above, you can add information to the document as metadata or content.
If a column in the database contains information that you want to use as the document content (for example a path to a file or base-64 encoded data), you can configure the connector to extract this data by setting the ContentField
and ContentFieldType
parameters. In this case, do not include a DRECONTENT
section in the template.