Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 71d40963b505df4524269198e237b3e3 > files > 902

virtuoso-opensource-doc-6.1.4-2.fc14.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head profile="http://internetalchemy.org/2003/02/profile">
  <link rel="foaf" type="application/rdf+xml" title="FOAF" href="http://www.openlinksw.com/dataspace/uda/about.rdf" />
  <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />
  <meta name="dc.title" content="18. Free Text Search" />
  <meta name="dc.subject" content="18. Free Text Search" />
  <meta name="dc.creator" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="dc.copyright" content="OpenLink Software, 1999 - 2009" />
  <link rel="top" href="index.html" title="OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="search" href="/doc/adv_search.vspx" title="Search OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="parent" href="freetext.html" title="Chapter Contents" />
  <link rel="prev" href=".html" title="" />
  <link rel="next" href="creatingtxtidxs.html" title="Creating Free Text Indexes" />
  <link rel="shortcut icon" href="../images/misc/favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" type="text/css" href="doc.css" />
  <link rel="stylesheet" type="text/css" href="/doc/translation.css" />
  <title>18. Free Text Search</title>
  <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
  <meta name="author" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="copyright" content="OpenLink Software, 1999 - 2009" />
  <meta name="keywords" content="" />
  <meta name="GENERATOR" content="OpenLink XSLT Team" />
 </head>
 <body>
  <div id="header">
    <a name="txtidxquickstart" />
    <img src="../images/misc/logo.jpg" alt="" />
    <h1>18. Free Text Search</h1>
  </div>
  <div id="navbartop">
   <div>
      <a class="link" href="freetext.html">Chapter Contents</a> | <a class="link" href="freetext.html" title="Free Text Search">Prev</a> | <a class="link" href="creatingtxtidxs.html" title="Creating Free Text Indexes">Next</a>
   </div>
  </div>
  <div id="currenttoc">
   <form method="post" action="/doc/adv_search.vspx">
    <div class="search">Keyword Search: <br />
        <input type="text" name="q" /> <input type="submit" name="go" value="Go" />
    </div>
   </form>
   <div>
      <a href="http://www.openlinksw.com/">www.openlinksw.com</a>
   </div>
   <div>
      <a href="http://docs.openlinksw.com/">docs.openlinksw.com</a>
   </div>
    <br />
   <div>
      <a href="index.html">Book Home</a>
   </div>
    <br />
   <div>
      <a href="contents.html">Contents</a>
   </div>
   <div>
      <a href="preface.html">Preface</a>
   </div>
    <br />
   <div class="selected">
      <a href="freetext.html">Free Text Search</a>
   </div>
    <br />
   <div class="selected">
      <a href="txtidxquickstart.html">Basic Concepts</a>
   </div>
   <div>
      <a href="creatingtxtidxs.html">Creating Free Text Indexes</a>
   </div>
   <div>
      <a href="queryingftcols.html">Querying Free Text Indexes</a>
   </div>
   <div>
      <a href="txttrig.html">Text Triggers</a>
   </div>
   <div>
      <a href="tablesandinternals.html">Generated Tables and Internals</a>
   </div>
   <div>
      <a href="droptxtindex.html">Removing A Text Index</a>
   </div>
   <div>
      <a href="droptxttrig.html">Removing A Text Trigger</a>
   </div>
   <div>
      <a href="ftinternationalization.html">Internationalization &amp; Unicode</a>
   </div>
   <div>
      <a href="ftperformance.html">Performance</a>
   </div>
   <div>
      <a href="fttfuncs.html">Free Text Functions</a>
   </div>
    <br />
  </div>
  <div id="text">
		<a name="txtidxquickstart" />
    <h2>18.1. Basic Concepts</h2>
  <p>
A text index is created with the <a href="creatingtxtidxs.html#createtxtidxstmt">CREATE TEXT INDEX</a>
statement.  This creates a number of stored procedures and triggers which will
transparently manage the text index.  A text index is dropped by dropping the
generated words table, called &lt;table&gt;_&lt;column&gt;_WORDS,
where &lt;table&gt; and &lt;column&gt; are the table and column over which the
index is made.
	</p>

		<a name="ex_quickstartfti" />
    <div class="example">
		<div class="exampletitle">Creating a Text Index</div>
  <div>
        <pre class="programlisting">
CREATE TABLE FTT (ID INTEGER, FILE varchar,  DT LONG VARCHAR );
CREATE TEXT INDEX ON FTT (DT);
</pre>
      </div>
  <p>
This is the simplest case of making a text index.  This process will add an
extra column to the table being indexed which it will use to reference rows
from the new text index.  If there already exists an integer primary key
then this will be used and no new column will be added.  Such a column may
not be 0 or negative.
</p>
  <p>
Once the index is made the contains query can be used to retrieve rows:
</p>
  <div>
        <pre class="programlisting">
insert into ftt (id, dt) values (1, &#39;foo&#39;);
select from ftt where contains (dt, &#39;foo&#39;);
</pre>
      </div>
</div>
  <p>
The contains predicate is a normal SQL predicate and can be used together
with other predicates in the where clause.  Contains may however not figure
inside an OR or NOT.  Hence:
</p>
  <div>
      <pre class="programlisting">
select * from ftt where contains (dt, &#39;foo or bar &#39;);
</pre>
    </div>
  <p>is OK but</p>
  <div>
      <pre class="programlisting">
select * from ftt where contains (dt, &#39;foo &#39;) or contains (dt, &#39;bar&#39;);
</pre>
    </div>
  <p>is not.</p>
<table border="0" width="90%" id="navbarbottom">
    <tr>
        <td align="left" width="33%">
          <a href="freetext.html" title="Free Text Search">Previous</a>
          <br />Contents of Free Text Search</td>
     <td align="center" width="34%">
          <a href="freetext.html">Chapter Contents</a>
     </td>
        <td align="right" width="33%">
          <a href="creatingtxtidxs.html" title="Creating Free Text Indexes">Next</a>
          <br />Creating Free Text Indexes</td>
    </tr>
    </table>
  </div>
  <div id="footer">
    <div>Copyright© 1999 - 2009 OpenLink Software All rights reserved.</div>
   <div id="validation">
    <a href="http://validator.w3.org/check/referer">
        <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" />
    </a>
    <a href="http://jigsaw.w3.org/css-validator/">
        <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" />
    </a>
   </div>
  </div>
 </body>
</html>