<!--
 -  
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2018 OpenLink Software
 -  
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -  
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -  
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  
-->
<?xml version="1.0" encoding="ISO-8859-1"?>
<refentry id="XS-S-1">
  <refmeta>
    <refentrytitle>XML Examples</refentrytitle>
    <refmiscinfo>tutorial</refmiscinfo>
  </refmeta>
  <refnamediv>
    <refname>Making a freetext index</refname>
    <refpurpose>Freetext index over XML data</refpurpose>
  </refnamediv>

<refsect1 id="XS-S-1a">
<title>Preliminaries</title>
<itemizedlist mark="bullet">
  <listitem>Virtuoso provides a compact and efficient free text indexing capability
   for text and XML data.  A free text index can be created on any character
   column, including wide and long data.</listitem>
  <listitem><para>If the column being indexed is XML data, this can be declared and enforced
   by the text index.  XML data will be indexed specially to support efficient
   XPATH predicate evaluation with the xcontains predicate.</para>

<programlisting>create_freetext_index
	: CREATE TEXT [XML] INDEX ON q_table_name '(' column ')'
	[WITH KEY column]
	[NOT INSERT]  
	[CLUSTERED WITH '(' column_commalist ')' ] 
	[USING FUNCTION]
	[LANGUAGE STRING]
	;</programlisting></listitem>
<listitem><para>The XML keyword specifies that the data is to be indexed as XML, hence
element names and attributes will be processed separately for use with the
XCONTAINS predicate.</para></listitem>
</itemizedlist>
</refsect1>

<refsect1 id="XS-S-1b">
<title>Example</title>
<itemizedlist mark="bullet">
  <listitem>The script inserts the files into the table.</listitem>
  <listitem>The data is stored as text, not as persistent XML.</listitem>
  <listitem>A VSP page shows the list of rows in the table.</listitem>
  <listitem><para>Each row has the following links:</para>
   <itemizedlist mark="bullet">
     <listitem>XML source - send the XML text as escaped text enclosed in an HTML &lt;pre&gt; tag.</listitem>
     <listitem>Raw XML - send the XML to the user agent, which must be able to render XML.</listitem>
   </itemizedlist></listitem>
</itemizedlist>
</refsect1>
</refentry>
