Author: natalia
Date: Thu Nov 8 18:37:35 2007
New Revision: 593401
URL: http://svn.apache.org/viewvc?rev=593401&view=rev
Log:
Updated XPath Guide documentation
Modified:
xml/xindice/trunk/src/documentation/content/xdocs/guide-xpath.xml
Modified: xml/xindice/trunk/src/documentation/content/xdocs/guide-xpath.xml
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/src/documentation/content/xdocs/guide-xpath.xml?rev=593401&r1=593400&r2=593401&view=diff
==============================================================================
--- xml/xindice/trunk/src/documentation/content/xdocs/guide-xpath.xml (original)
+++ xml/xindice/trunk/src/documentation/content/xdocs/guide-xpath.xml Thu Nov 8 18:37:35 2007
@@ -28,7 +28,7 @@
<document>
<header>
- <title>Xindice 1.1 XPath Guide</title>
+ <title>Xindice 1.2 XPath Guide</title>
<version>$Revision$</version>
<authors>
<person id="VG" name="Vadim Gritsenko" email=""/>
@@ -48,7 +48,7 @@
<p>
Xindice currently supports XPath as a query language. Queries can
be executed from within client application (please refer to the
- <link href="guide-developer.html">developers giude</link>), through
+ <link href="guide-developer.html">developers guide</link>), through
XML-RPC interface, or via a command line (please refer to the
<link href="guide-tools.html">command line tool guide</link>).
This document describes what XPath queries are supported and what are
@@ -60,9 +60,10 @@
<title>Sample Database</title>
<p>
XPath queries and results described below were run against sample
- /db/addressbook collection. Documents in the addressbook collection
- have following structure:
+ /db/addressbook collection. There are two documents in the addressbook
+ collection.
</p>
+ <p>Key: <code>address1</code></p>
<source><![CDATA[
<?xml version="1.0"?>
<person>
@@ -76,6 +77,21 @@
<address type="work">9967 W. Shrimp Ave.</address>
</person>
]]></source>
+ <p>Key: <code>address2</code></p>
+ <source><![CDATA[
+ <?xml version="1.0"?>
+ <person>
+ <fname>SlackJawedLocal</fname>
+ <lname>Cletus</lname>
+ <phone type="work">123-456-7890</phone>
+ <phone type="home">234-567-8901</phone>
+ <phone type="cell">345-678-9012</phone>
+ <email type="home">[email protected]</email>
+ <email type="work">[email protected]</email>
+ <address type="home">1234 S. Elm St.</address>
+ <address type="work">4567 W. Pine St.</address>
+ </person>
+ ]]></source>
</section>
<section>
@@ -186,5 +202,35 @@
]]></source>
</section>
+ <section>
+ <title>Using full text search in XPath</title>
+ <p>
+ Full text search functionality is available in XPath queries in Xindice as an extention function.
+ <p>Function: boolean ftcontains(string)</p>
+
+ The ftcontains function returns true if text content of the context
+ node matches full text query passed as the argument, otherwise it
+ returns false. Text query syntax is the same as
+ <link href="http://lucene.apache.org/java/docs/queryparsersyntax.html">Lucene query syntax</link>,
+ except it does not use fields (using fields does not cause errors
+ when parsing the query, but function will return false).
+ </p>
+ <source> xindice xpath -c /db/addressbook -q "/person/address[@type='work']/text()[ftcontains('pine')]" </source>
+ <p>
+ This XPath will return all work addresses of all people in database that
+ contain word 'pine'.
+ </p>
+ <source><![CDATA[
+ <xq:result xmlns:xq="http://xml.apache.org/xindice/Query"
+ xq:col="/db/addressbook" xq:key="address2">4567 W. Pine St.</xq:result>
+ ]]></source>
+ <note>
+ Function results depend on the analyzer that is used to tokenize both
+ node text content and a query. If LuceneIndexer exists for the
+ collection being queried, same analyzer will be used for the ftcontains
+ function to produce consistent results. If LuceneIndexer is not found,
+ default analyzer will be used (at this time it is SimpleAnalyzer).
+ </note>
+ </section>
</body>
</document>
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.