<?xml version="1.0" encoding="UTF-8"?>

<!--
  - Licensed to the Apache Software Foundation (ASF) under one or more
  - contributor license agreements.  See the NOTICE file distributed with
  - this work for additional information regarding copyright ownership.
  - The ASF licenses this file to You under the Apache License, Version 2.0
  - (the "License"); you may not use this file except in compliance with
  - the License.  You may obtain a copy of the License at
  -
  -     http://www.apache.org/licenses/LICENSE-2.0
  -
  - Unless required by applicable law or agreed to in writing, software
  - distributed under the License is distributed on an "AS IS" BASIS,
  - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - See the License for the specific language governing permissions and
  - limitations under the License.
  -
  - $Id$
  -->

<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "document-v20.dtd">

<!--
  - Version: $Revision$ $Date$
  - Author: Kimbro Staken (kstaken@xmldatabases.org)
  -->

<document>
  <header>
    <title>Xindice 1.2 Commandline Tool Guide</title>
    <version>$Revision$</version>
    <authors>
      <person id="jk" name="Jay Kalafus" email=""/>
      <person id="ks" name="Kimbro Staken" email=""/>
    </authors>
    <notice/>
    <abstract/>
  </header>

  <body>
    <note>
      If you notice incorrectness in this documentation, please
      <a href="../mail.html">notify</a> Xindice community. Your feedback
      will help to create better documentation.
    </note>

    <section>
      <title>General Information</title>
      <section>
        <title>Collection context</title>
        <p>
          Collection context refers to a collection location. It can be either
          collection canonical name or complete XML:DB URL. The collection
          context points to must already exist.
        </p>
        <p>
          Collection canonical name starts with '/', then has a database name
          and the collection path. So, a collection 'foo' under a collection
          'bar' in database 'db' will have canonical name /db/bar/foo.
          Canonical names are used for convenience and are converted to complete
          URLs by the command tool.
        </p>
        <p>
          Complete URL has the following format:
          <code>xmldb:&lt;driver_protocol&gt;://&lt;host&gt;:&lt;port&gt;&lt;path&gt;</code>,
          where
        </p>
          <dl>
            <dt><code>driver_protocol</code></dt>
            <dd>
              Either <code>xindice</code> (XML-RPC driver) or <code>xindice-embed</code>
              (embedded driver). Driver choice depends on whether or not -l switch was
              specified.
            </dd>
            <dt><code>host</code> and <code>port</code></dt>
            <dd>
              Host name or IP address and port number where Xindice server is running.
              This information only is used for XML-RPC driver, it can be present in
              URL when embedded driver is used, but will be ignored, so usually it is
              omitted. For XML-RPC, host name and port number can be omitted, too, then
              default address 127.0.0.1:8888 is used.
            </dd>
            <dt><code>path</code></dt>
            <dd>
              Collection canonical name
            </dd>
          </dl>
        <p><strong>Examples</strong></p>
        <source><![CDATA[
  xmldb:xindice://10.1.1.1:8889/db1/col1/col2]]></source>
        <p>
          Context points to a collection col2, which is a child of the collection col1,
          located in database db1 that is available on Xindice server running on host
          10.1.1.1 with port number 8889. To communicate with the server, XML-RPC
          protocol will be used.
        </p>
        <source><![CDATA[
  xmldb:xindice-embed:///db1/col1/col2]]></source>
        <p>
          Context points to a collection col2, which is a child of the collection col1,
          located in database db1 that is available on embedded Xindice instance.
          Command tool will use embedded driver.
        </p>
        <source><![CDATA[
  /db1/col1/col2]]></source>
        <p>
          If -l switch was specified, this canonical name will be converted to
          <code>xmldb:xindice-embed:///db1/col1/col2</code>. Otherwise, the result
          will be <code>xmldb:xindice:///db1/col1/col2</code> (please note, that
          the default target address 127.0.0.1:8888 will be used).
        </p>
      </section>
      <section>
        <title>Common parameters</title>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context that points to Xindice collection under
            which the action will be executed. The context can be either
            canonical name of the collection or complete XML:DB URL. The
            collection context points to must already exist.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network. This is done
            by using different driver to access database, embedded driver will
            be used instead of XML-RPC. This parameter should be combined with
            -d to specify system configuration to use.
          </dd>
          <dt><code>-d &lt;file path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified. If this parameter is
            omitted, Xindice will look for system property "xindice.configuration",
            which can be set by setting environment variable XINDICE_CONFIG or
            by specifying it as the -D parameter for java command, which is
            what usually xindice command does itself.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
          <dt><code>-h</code></dt>
          <dd>
            Print help screen for an action.
          </dd>
        </dl>
      </section>
    </section>
    <section>
      <title>Collection Management Commands</title>

      <section>
        <title>Adding a Collection</title>
        <p>
          Adds a new collection to the database. When adding a collection
          under an existing collection hierarchy all parent collections must
          already exist in the database.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice add_collection -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p>
          Command name abbreviation: <code>ac</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-n &lt;name&gt;</code></dt>
          <dd>
            Name for the collection to be created, must be present unless
            collection configuration is specified. It can also be a collection
            path rather than a name, in that case all parent collections must
            already exist.
          </dd>
          <dt><code>-f &lt;file&gt;</code></dt>
          <dd>
            Name of the file that holds collection configuration. If specified,
            the rest of command-specific parameters (like collection name) are
            ignored. A configuration may include child collections or indexers,
            all of them will be created at the same time as well.
          </dd>
          <dt><code>--filer &lt;name&gt;</code></dt>
          <dd>
            Collection filer, can be HashFiler or BTreeFiler (default:
            BTreeFiler). A filer defines which data structure is going to be used
            for storing information. HashFiler generally is more suitable for
            collections that are not expected to grow significantly.
          </dd>
          <dt><code>--pagesize &lt;number&gt;</code></dt>
          <dd>
            Page size for file pages (default: 4096 bytes).
          </dd>
          <dt><code>--pagecount &lt;number&gt;</code></dt>
          <dd>
            Initial number of pages in the primary storage (default: 1024).
            <ul>
              <li>
                BTreeFiler: number of pages filer will be created with. This
                number can grow as more and more documents are added to the collection
              </li>
              <li>
                HashFiler: the size of the hash table main storage. Main storage
                size is constant. If main storage is at its capacity, documents
                are stored in overflow storage, affecting efficiency of the hash
                table
              </li>
            </ul>
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>Create a top level collection pebbles in database db. Collection will use
          BTreeFiler with default values for page count and page size.</p>
        <source><![CDATA[
  xindice add_collection -c /db -n pebbles
          ]]></source>
        <p>Create a child collection boulder in collection pebbles.</p>
        <source><![CDATA[
  xindice add_collection -c /db/pebbles -n boulder
          ]]></source>
        <p>Create a child collection stone in collection boulder.</p>
        <source><![CDATA[
  xindice add_collection -c /db/pebbles -n boulder/stone
          ]]></source>
        <p>Create a child collection sand in collection pebbles that uses
          HashFiler with page size equal to 1024 bytes and the size of the hash table main
          storage equals to 2048.</p>
        <source><![CDATA[
  xindice add_collection -c /db/pebbles -n sand --filer HashFiler --pagesize 1024 --pagecount 2048
          ]]></source>
        <p>Create a child collection in collection pebbles with the configuration specified
          in the file /tmp/collections/config.xml. If collection configuration contains
          any child collections or indexers, they will be created as well.</p>
        <source><![CDATA[
  xindice add_collection -c /db/pebbles -f /tmp/collections/config.xml
          ]]></source>
      </section>

      <section>
        <title>Deleting a Collection</title>
        <p>
          Deletes a collection or subcollection from the database. If deleting
          a collection that has subcollections, indexers and/or documents
          they will also be deleted.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice delete_collection -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p>
          Command name abbreviation: <code>dc</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-n &lt;name&gt;</code></dt>
          <dd>
            Name of the collection to delete. Required. It can also be a collection
            path rather than a name.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>Delete a top level collection pebbles and all its subcollections,
          indexers and documents.</p>
        <source><![CDATA[
  xindice delete_collection -c /db -n pebbles
          ]]></source>
        <p>Delete a child collection boulder from collection pebbles and
          all its subcollections, indexers and documents.</p>
        <source><![CDATA[
  xindice delete_collection -c /db/pebbles -n boulder
          ]]></source>
        <p>Delete a child collection stone from collection boulder. Collection
          boulder is not affected.</p>
        <source><![CDATA[
  xindice delete_collection -c /db/pebbles -n boulder/stone
          ]]></source>
      </section>

      <section>
        <title>List Collections</title>
        <p>
          List all child collections under the given collection context.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice list_collections -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v]</code>
        </p>
        <p>
          Command name abbreviation: <code>lc</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>List the top level collections in database db.</p>
        <source><![CDATA[
  xindice list_collections -c /db
          ]]></source>
        <p>List child collections of collection pebbles.</p>
        <source><![CDATA[
  xindice list_collections -c /db/pebbles
          ]]></source>
      </section>
    </section>

    <section>
      <title>Document Management Commands</title>

      <section>
        <title>Adding a Document</title>
        <p>
          Adds a document to a collection. Adding a document requires the file
          path to the document. If a document key is not provided an auto-generated
          system key will be used for the document. When entering the file path be
          sure to include the path and file extension.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice add_document -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p>
          Command name abbreviation: <code>ad</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-f &lt;file&gt;</code></dt>
          <dd>
            File path for the file with the document being added to the
            collection. Required. File content must be a well-formed XML
            document.
          </dd>
          <dt><code>-n &lt;key&gt;</code></dt>
          <dd>
            Key assigned to the document key. If this parameter is omitted,
            database will generate an unique key and assign it to the document.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>Add a document to the collection pebbles with a key "stones".</p>
        <source><![CDATA[
  xindice add_document -c /db/pebbles -f /tmp/stones.xml -n stones
          ]]></source>
        <p>Add a document to the collection boulder with an automatically generated key.</p>
        <source><![CDATA[
  xindice add_document -c /db/pebbles/boulder -f /tmp/bookmarks.xml
          ]]></source>
      </section>

      <section>
        <title>Adding a Binary Resource</title>
        <p>
          Adds a binary resource a collection, if support of binary resources
          has been turned on for the collection. If a resource key is not
          provided an auto-generated system key will be used for the resource.
          When entering the file path be sure to include the path and file
          extension.
        </p>
        <p>
          The resource may or may not be XML document. Even if resouce
          is XML document, it cannot be indexed, cannot be quieried with XPath
          or modified with XUpdate.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice add_resource -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p>
          Command name abbreviation: <code>ar</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-f &lt;file path&gt;</code></dt>
          <dd>
            File path for the resource being added to the collection. Required.
          </dd>
          <dt><code>-n &lt;key&gt;</code></dt>
          <dd>
            Key assigned to the resource. If this parameter is omitted,
            database will generate an unique key and assign it to the resource.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>Add a resource to a collection pebbles with a key "stones".</p>
        <source><![CDATA[
  xindice add_document -c /db/pebbles -f /tmp/stones.jpg -n stones
          ]]></source>
        <p>Add a resource to the collection boulder with an automatically generated key.</p>
        <source><![CDATA[
  xindice add_resource -c /db/pebbles/boulder -f /tmp/bookmarks.html
          ]]></source>
      </section>

      <section>
        <title>Adding Multiple Documents</title>
        <p>
          Adds multiple documents to a collection. This command requires
          the argument pointing to the directory path that contains documents,
          which are going to be stored in the collection specified by
          collection context. The collection must already exist. Documents
          added will be assigned their file name as the document key. The
          optional "extension" parameter can be used to only import documents
          with a certain file extension.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice add_multiple_documents -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p>
          Command name abbreviation: <code>addmultiple</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-f &lt;path&gt;</code></dt>
          <dd>
            Directory name to import documents from. Required.
          </dd>
          <dt><code>-e &lt;extention&gt;</code></dt>
          <dd>
            The file extention that files must have in order to be added to the
            collection.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>Add all files from directory /tmp/mydocs to the collection pebbles.</p>
        <source><![CDATA[
  xindice add_multiple_documents -c /db/pebbles -f /tmp/mydocs
          ]]></source>
        <p>Add all files from directory /tmp/mydocs that have an extension ".xml" to
          the collection pebbles.</p>
        <source><![CDATA[
  xindice add_multiple_documents -c /db/pebbles -f /tmp/mydocs -e xml
          ]]></source>
      </section>

      <section>
        <title>Deleting a Document</title>
        <p>
          Deletes an existing document from a collection.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice delete_document -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p>
          Command name abbreviation: <code>dd</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-n &lt;name&gt;</code></dt>
          <dd>
            The key of the document to be deleted. Required.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>Delete a document with the key "stones" from the collection pebbles.</p>
        <source><![CDATA[
  xindice delete_document -c /db/pebbles -n stones
          ]]></source>
      </section>

      <section>
        <title>Retrieving a Document</title>
        <p>
          Retrieves an existing document from a collection and stores it in
          the file. If the path passed in does not exist, it will be created.
          If the file specified by path argument already exists, it will be
          overwritten.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice retrieve_document -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p>
          Command name abbreviation: <code>rd</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-n &lt;name&gt;</code></dt>
          <dd>
            The key of the document to be retrieved. Required.
          </dd>
          <dt><code>-f &lt;file&gt;</code></dt>
          <dd>
            The file path to store the document under. Required.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>Retrieve a document with the key "stones" from the collection pebbles
        and save it in the file /tmp/stones.xml.</p>
        <source><![CDATA[
  xindice retrieve_document -c /db/pebbles -n stones -f /tmp/stones.xml
          ]]></source>
      </section>

      <section>
        <title>List Resources</title>
        <p>
          List all resource keys under the given collection context.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice list_documents -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p>
          Command name abbreviation: <code>ld</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>List all documents in the collection pebbles.</p>
        <source><![CDATA[
  xindice list_documents -c /db/pebbles
          ]]></source>
      </section>

      <section>
        <title>Importing a Directory Tree</title>
        <p>
          Adds multiple documents into a collection, copying the directory
          structure into the database as collections. This command takes a
          directory and creates a collection with the same name. Directories
          under the directory will also be created as child collections,
          duplicating the directory tree. The files within the specified
          directory are converted into documents and then stored into the
          newly created collection with their filenames as the document keys.
          The optional "extension" parameter can be used to only import
          documents with a certain file extension.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice import -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-f &lt;path&gt;</code></dt>
          <dd>
            The path to a directory to be imported as a collection. Required.
          </dd>
          <dt><code>-e &lt;extention&gt;</code></dt>
          <dd>
            The file extention that files must have in order to be added to the
            collection.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>Import all directories and documents to the collection pebbles, starting
          with directory /tmp/flintstones.</p>
        <source><![CDATA[
  xindice import -c /db/pebbles -f /tmp/flintstones
          ]]></source>
        <p>Import all directories and documents with an extension of ".xml" to the
          collection pebbles, starting with directory /tmp/flintstones.</p>
        <source><![CDATA[
  xindice import -c /db/pebbles -f /tmp/flintstones -e xml
          ]]></source>
      </section>

      <section>
        <title>Exporting a Directory Tree</title>
        <p>
          Creates an directory tree from a collection and its subcollections.
          The directory tree will be created starting at the directory passed
          in as an argument. That directory must exist already. The collection
          documents will be converted to files with the keys used as file names.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice export -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-f &lt;path&gt;</code></dt>
          <dd>
            The path to a directory where collection structure will be created.
            The directory must already exist. Required.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>Creating a directory tree indentical to a collection pebbles tree in
        directory /tmp/export</p>
        <source><![CDATA[
  xindice export -c /db/pebbles -f /tmp/export
          ]]></source>
      </section>
    </section>

    <section>
      <title>Collection Indexer Actions</title>
      <section>
        <title>Adding a Collection Indexer</title>
        <p>
          Adds a new collection index. In order to add the collection index,
          the collection it is being added to must already exist. This command
          has optional parameters for setting the index page size, index page
          count, and the index data type.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice add_indexer -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p>
          Command name abbreviation: <code>ai</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-n &lt;name&gt;</code></dt>
          <dd>
            The name of the indexer. Required.
          </dd>
          <dt><code>-p &lt;pattern&gt;</code></dt>
          <dd>
            The pattern used to create the index. Required, unless indexer configuration
            is specified. Name and Value indexers can only have one pattern,
            which is going to follow the -p switch. Full text indexer can have multiple
            patterns and its syntax is different, -p switch is followed by semicolon
            delimited list of patterns for indexer in the form pattern=alias.
          </dd>
          <dt><code>-t &lt;type&gt;</code></dt>
          <dd>
            The data type/index type.
          </dd>
          <dt><code>-f &lt;file&gt;</code></dt>
          <dd>
            Name of the file that holds indexer configuration. If specified,
            the rest of command-specific parameters (like indexer name) are
            ignored.
          </dd>
          <dt><code>--pagesize &lt;pagesize&gt;</code></dt>
          <dd>
            Page size for file pages (default: 4096). Does not apply to
            LuceneIndexer.
          </dd>
          <dt><code>--pagecount &lt;pagecount&gt;</code></dt>
          <dd>
            Number of pages in the primary storage (default: 1024). Does
            not apply to LuceneIndexer.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>

        <p>Possible values of index type are:</p>
          <table>
            <tr>
              <th>Type</th><th>What is indexed</th><th>Indexer type</th>
            </tr>
            <tr>
              <td>string</td><td>Non-normalized string value</td><td>ValueIndexer</td>
            </tr>
            <tr>
              <td>trimmed</td><td>Normalized (whitespace stripped) string value</td><td>ValueIndexer</td>
            </tr>
            <tr>
              <td>short</td><td>16-bit signed short integer</td><td>ValueIndexer</td>
            </tr>
            <tr>
              <td>int</td><td>32-bit signed integer</td><td>ValueIndexer</td>
            </tr>
            <tr>
              <td>long</td><td>64-bit signed integer</td><td>ValueIndexer</td>
            </tr>
            <tr>
              <td>float</td><td>32-bit floating point value</td><td>ValueIndexer</td>
            </tr>
            <tr>
              <td>double</td><td>64-bit floating point value (XPath number)</td><td>ValueIndexer</td>
            </tr>
            <tr>
              <td>byte</td><td>8-bit signed byte</td><td>ValueIndexer</td>
            </tr>
            <tr>
              <td>char</td><td>16-bit signed character</td><td>ValueIndexer</td>
            </tr>
            <tr>
              <td>boolean</td><td>8-bit boolean value</td><td>ValueIndexer</td>
            </tr>
            <tr>
              <td>name</td><td>Presence of the pattern in a document</td><td>NameIndexer</td>
            </tr>
            <tr>
              <td>text</td><td>Pattern text content</td><td>LuceneIndexer</td>
            </tr>
          </table>

        <p>
          By default type will be "string" for element pattern or "trimmed"
          for attribute pattern.
        </p>
        <p><strong>Examples</strong></p>
        <p>
          Create a Value indexer named "rockindex" in the pebbles collection and
          index value of a "rock" element as a string.
        </p>
        <source><![CDATA[
  xindice add_indexer -c /db/pebbles -n rockindex -p rock
          ]]></source>
        <p>
          Create a Value indexer with name "hardindex" in the boulder collection
          for documents containing a rock elements with an attribute of "hard" and
          index value of an attribute "hard" of the "rock" element as normalized
          string.
        </p>
        <source><![CDATA[
  xindice add_indexer -c /db/pebbles/boulder -n hardindex -p rock@hard
          ]]></source>
        <p>
          Create a Value indexer named "weight" in the pebbles collection and index
          value of an attribute "weight" of the "rock" element as a floating point
          value.
        </p>
        <source><![CDATA[
  xindice add_indexer -c /db/pebbles -n weight -p rock@weight -t float
          ]]></source>
        <p>
          Create a Name indexer named "type" in the pebbles collection and index
          document keys of the documents that contain "rock" elements with an
          attribute of "type".
        </p>
        <source><![CDATA[
  xindice add_indexer -c /db/pebbles -n type -p rock@type -t name
          ]]></source>
        <p>
          Create a Lucene indexer named "text" in the pebbles collection and index
          text content of element "origin" (with alias "origin") and text of attribute
          "donatedby" of the element "location" (with alias "donated").
        </p>
        <source><![CDATA[
  xindice add_indexer -c /db/pebbles -n text -p origin=origin;location@donatedby=donated -t text
          ]]></source>
      </section>

      <section>
        <title>Deleting a Collection Indexer</title>
        <p>
          Deletes a collection index referred by the name. Deleting an index
          does not affect collection and its documents.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice delete_indexer -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p>
          Command name abbreviation: <code>di</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-n &lt;name&gt;</code></dt>
          <dd>
            The name of the indexer being deleted. Required.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>Delete index with name "hardindex" in the pebbles collection.</p>
        <source><![CDATA[
  xindice delete_indexer -c /db/pebbles -n hardindex
          ]]></source>
      </section>

      <section>
        <title>Listing Collection Indexers</title>
        <p>
          Lists all indexers of a collection.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice list_indexers -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p>
          Command name abbreviation: <code>li</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>To list all collection indexes in the pebbles collection  </p>
        <source><![CDATA[
  xindice list_indexers -c /db/pebbles
          ]]></source>
      </section>
    </section>

    <section>
      <title>Quering a Collection</title>
      <section>
        <title>Xpath Query</title>
        <p>
          Execute XPath query against a collection. The query is executed for all
          documents in the collection.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice xpath -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-q &lt;query&gt;</code></dt>
          <dd>
            XPath query to execute. Required.
          </dd>
          <dt><code>-s &lt;namespaces&gt;</code></dt>
          <dd>
            Semicolon delimited list of namespaces for query in the form
            prefix=namespace-uri.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>
          Run XPath query against all documents in the pebbles collection
          and find all "rock" elements that have the "type" attribute
          equals to "hard".
        </p>
        <source><![CDATA[
  xindice xpath -c /db/pebbles -q "/rock[@type='hard']"
          ]]></source>
        <p>
          Run Xpath query against all documents in the pebbles collection
          and find all "rock" elements that have the "type" attribute equals
          to "hard" when the rock element is in the namespace
          http://www.bedrock.com.
        </p>
        <source><![CDATA[
  xindice xpath -c /db/pebbles -s "br=http://www.bedrock.com" -q "/br:rock[@type='hard']"
          ]]></source>
      </section>

      <section>
        <title>XUpdate Query</title>
        <p>
          Execute XUpdate query against a document or a collection.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice xupdate -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-f &lt;file path&gt;</code></dt>
          <dd>
            Name of the file which holds XUpdate query. Required.
          </dd>
          <dt><code>-n &lt;name&gt;</code></dt>
          <dd>
            Document key, if query to be run against single document.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>
          Run XUpdate query from file /path/to/xupdate.xml against all
          documents in the test collection.
        </p>
        <source><![CDATA[
  xindice xupdate -c /db/test -f /path/to/xupdate.xml
          ]]></source>
        <p>
          Run XUpdate query from file /path/to/xupdate.xml against the document
          with the key "document-to-update.xml" in the test collection.
        </p>
        <source><![CDATA[
  xindice xupdate -c /db/test -n document-to-update.xml -f /path/to/xupdate.xml
          ]]></source>
      </section>

      <section>
        <title>Full Text Query</title>
        <p>
          Execute Lucene query against a collection. This type of query
          requires existing LuceneIndexer for the collection.
        </p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice xpath -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v] [parameters...]</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-q &lt;query&gt;</code></dt>
          <dd>
            Lucene query to execute. Required.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>
          Find documents that have word 'Xindice' and do not have word 'XPath'
          in the text content of "title" element in the book collection,
          assuming that element "title" is included in LuceneIndexer with alias
          "chaptertitle".
        </p>
        <source><![CDATA[
  xindice xpath -c /db/pebbles -q "+chaptertitle:Xindice -chaptertitle:XPath"
          ]]></source>
      </section>
    </section>

    <section>
      <title>Miscellaneous Actions</title>
      <section>
        <title>Shutting down the Server</title>
        <p>Shuts down the Xindice server. Shutdown command only works with embedded driver.
        Usually, this command is unnecessary, because all other commands will execute
        shutdown command after their main work has been done, if embedded drived is used.
        For XML-RPC driver, command can be executed, but it does not do anything, as the
        lifecycle is managed by application container (such as Tomcat).</p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice shutdown -c &lt;context&gt; [-l [-d &lt;path&gt;]] [-v]</code>
        </p>
        <p><strong>Parameters</strong></p>
        <dl>
          <dt><code>-c &lt;context&gt;</code></dt>
          <dd>
            The collection context. Required.
          </dd>
          <dt><code>-l</code></dt>
          <dd>
            Use a local database rather then going over the network.
            Should be combined with -d to specify the configuration to use.
          </dd>
          <dt><code>-d &lt;path&gt;</code></dt>
          <dd>
            Path to the database configuration to use for the local
            database. Only applies if -l is specified.
          </dd>
          <dt><code>-v</code></dt>
          <dd>
            Show verbose output, additional information and exceptions.
          </dd>
        </dl>
        <p><strong>Examples</strong></p>
        <p>Shutdown the server</p>
        <source><![CDATA[
  xindice shutdown -c /db
          ]]></source>
      </section>

      <section>
        <title>Accessing Help</title>
        <p>Show available commands</p>
        <p><strong>Summary</strong></p>
        <p>
          <code>xindice --help</code>
        </p>
        <p>
          Command name abbreviations: <code>-h, help</code>
        </p>
      </section>
    </section>
  </body>
</document>
