<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Using text search</title>
    <link>/en/admin/using-text-search/</link>
    <description>Recent content in Using text search on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/admin/using-text-search/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Admin: Creating a text index</title>
      <link>/en/admin/using-text-search/creating-text-index/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/using-text-search/creating-text-index/</guid>
      <description>
        
        
        &lt;p&gt;In the following example, you perform a text search using a source table called t_log. This source table has two columns:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;One column containing the table&#39;s primary key&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Another column containing log file information&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You must associate a projection with the source table. Use a projection that is sorted by the primary key and either segmented by hash(id) or unsegmented. You can define this projection on the source table, along with any other existing projections.&lt;/p&gt;
&lt;p&gt;Use &lt;a href=&#34;../../../en/sql-reference/statements/create-statements/create-text-index/#&#34;&gt;CREATE TEXT INDEX&lt;/a&gt; on the table for which you want to perform a text search.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TEXT INDEX text_index ON t_log (id, text);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The text index contains two columns:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;doc_id uses the unique identifier from the source table.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;token is populated with text strings from the designated column from the source table. The word column results from tokenizing and stemming the words found in the text column.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If your table is partitioned then your text index also contains a third column named &lt;em&gt;partition&lt;/em&gt;.&lt;/p&gt;

&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM text_index;
          token         | doc_id | partition
------------------------+--------+-----------
&amp;lt;info&amp;gt;                  |      6 |      2014
&amp;lt;warning&amp;gt;               |      2 |      2014
&amp;lt;warning&amp;gt;               |      3 |      2014
&amp;lt;warning&amp;gt;               |      4 |      2014
&amp;lt;warning&amp;gt;               |      5 |      2014
database                |      6 |      2014
execute:                |      6 |      2014
object                  |      4 |      2014
object                  |      5 |      2014
[catalog]               |      4 |      2014
[catalog]               |      5 |      2014
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You create a text index on a source table only once. In the future, you do not have to re-create the text index each time the source table is updated or changed.&lt;/p&gt;
&lt;p&gt;The index contains all existing data and stays synchronized to the contents of the source table through any subsequent DML operations. These operations include, but are not limited to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;COPY&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;INSERT&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;UPDATE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DELETE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DROP PARTITION&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;MOVE_PARTITIONS_TO_TABLE&lt;/p&gt;
&lt;p&gt;When you move or swap partitions in a source table that is indexed, verify that the destination table already exists and is indexed in the same way.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;


      </description>
    </item>
    
    <item>
      <title>Admin: Creating a text index on a flex table</title>
      <link>/en/admin/using-text-search/creating-text-index-on-flex-table/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/using-text-search/creating-text-index-on-flex-table/</guid>
      <description>
        
        
        &lt;p&gt;In the following example, you create a text index on a flex table. The example assumes that you have created a flex table called mountains. See &lt;a href=&#34;../../../en/flex-tables/getting-started/#&#34;&gt;Getting started&lt;/a&gt; in Using Flex Tables to create the flex table used in this example.&lt;/p&gt;
&lt;p&gt;Before you can create a text index on your flex table, add a primary key constraint to the flex table.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER TABLE mountains ADD PRIMARY KEY (__identity__);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use &lt;a href=&#34;../../../en/sql-reference/statements/create-statements/create-text-index/#&#34;&gt;CREATE TEXT INDEX&lt;/a&gt; on the table for which you want to perform a text search. Tokenize the __raw__column with the FlexTokenizer and specify the data type as LONG VARBINARY. It is important to use the FlexTokenizer when creating text indices on flex tables because the data type of the __raw__ column differs from the default StringTokenizer.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TEXT INDEX flex_text_index ON mountains(__identity__, __raw__) TOKENIZER public.FlexTokenizer(long varbinary);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The text index contains two columns:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;doc_id uses the unique identifier from the source table.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;token is populated with text strings from the designated column from the source table. The word column results from tokenizing and stemming the words found in the text column.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If your table is partitioned then your text index also contains a third column named &lt;em&gt;partition&lt;/em&gt;.&lt;/p&gt;

&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM flex_text_index;
    token    | doc_id
-------------+--------
 50.6        |      5
 Mt          |      5
 Washington  |      5
 mountain    |      5
 12.2        |      3
 15.4        |      2
 17000       |      3
 29029       |      2
 Denali      |      3
 Helen       |      2
 Mt          |      2
 St          |      2
 mountain    |      3
 volcano     |      2
 29029       |      1
 34.1        |      1
 Everest     |      1
 mountain    |      1
 14000       |      4
 Kilimanjaro |      4
 mountain    |      4
(21 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You create a text index on a source table only once. In the future, you do not have to re-create the text index each time the source table is updated or changed.&lt;/p&gt;
&lt;p&gt;The index contains all existing data and stays synchronized to the contents of the source table through any subsequent DML operations. These operations include, but are not limited to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;COPY&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;INSERT&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;UPDATE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DELETE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DROP PARTITION&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;MOVE_PARTITIONS_TO_TABLE&lt;/p&gt;
&lt;p&gt;When you move or swap partitions in a source table that is indexed, verify that the destination table already exists and is indexed in the same way.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;


      </description>
    </item>
    
    <item>
      <title>Admin: Searching a text index</title>
      <link>/en/admin/using-text-search/searching-text-index/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/using-text-search/searching-text-index/</guid>
      <description>
        
        
        &lt;p&gt;After you create a text index, write a query to run against the index to search for a specific keyword.&lt;/p&gt;
&lt;p&gt;In the following example, you use a WHERE clause to search for the keyword &amp;lt;WARNING&amp;gt; in the text index. The WHERE clause should use the stemmer you used to create the text index. When you use the STEMMER keyword, it stems the keyword to match the keywords in your text index. If you did not use the STEMMER keyword, then the default stemmer is v_txtindex.StemmerCaseInsensitive. If you used STEMMER NONE, then you can omit STEMMER keyword from the WHERE clause.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM text_index WHERE token = v_txtindex.StemmerCaseInsensitive(&amp;#39;&amp;lt;WARNING&amp;gt;&amp;#39;);
  token    | doc_id
-----------+--------
&amp;lt;warning&amp;gt;  |     2
&amp;lt;warning&amp;gt;  |     3
&amp;lt;warning&amp;gt;  |     4
&amp;lt;warning&amp;gt;  |     5
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Next, write a query to display the full contents of the source table that match the keyword you searched for in the text index.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t_log WHERE id IN (SELECT doc_id FROM text_index WHERE token = v_txtindex.StemmerCaseInsensitive(&amp;#39;&amp;lt;WARNING&amp;gt;&amp;#39;));
id |    date    |                                     text
---+------------+-----------------------------------------------------------------------------------------------
4  | 2014-06-04 | 11:00:49.568 unknown:0x7f9207607700 [Catalog] &amp;lt;WARNING&amp;gt; validateDependencies: Object 45035968
5  | 2014-06-04 | 11:00:49.568 unknown:0x7f9207607700 [Catalog] &amp;lt;WARNING&amp;gt; validateDependencies: Object 45030
2  | 2013-06-04 | 11:00:49.568 unknown:0x7f9207607700 [Catalog] &amp;lt;WARNING&amp;gt; validateDependencies: Object 4503
3  | 2013-06-04 | 11:00:49.568 unknown:0x7f9207607700 [Catalog] &amp;lt;WARNING&amp;gt; validateDependencies: Object 45066
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use the doc_id to find the exact location of the keyword in the source table.The doc_id matches the unique identifier from the source table. This matching allows you to quickly find the instance of the keyword in your table.&lt;/p&gt;
&lt;h2 id=&#34;performing-a-case-sensitive-and-case-insensitive-text-search-query&#34;&gt;Performing a case-sensitive and case-insensitive text search query&lt;/h2&gt;
&lt;p&gt;Your text index is optimized to match all instances of words depending upon your stemmer. By default, the case insensitive stemmer is applied to all text indices that do not specify a stemmer. Therefore, it is recommended that you use a case sensitive stemmer to build your text index if the queries you plan to write against your text index are case sensitive.&lt;/p&gt;
&lt;p&gt;The following examples show queries that match case-sensitive and case-insensitive words that you can use when performing a text search.&lt;/p&gt;
&lt;p&gt;This query finds case-insensitive records in a case insensitive text index:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t_log WHERE id IN (SELECT doc_id FROM text_index WHERE token = v_txtindex.StemmerCaseInsensitive(&amp;#39;warning&amp;#39;));
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This query finds case-sensitive records in a case sensitive text index:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM t_log_case_sensitive WHERE id IN (SELECT doc_id FROM text_index WHERE token = v_txtindex.StemmerCaseSensitive(&amp;#39;Warning&amp;#39;));
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;including-and-excluding-keywords-in-a-text-search-query&#34;&gt;Including and excluding keywords in a text search query&lt;/h2&gt;
&lt;p&gt;Your text index also allows you to perform more detailed queries to find multiple keywords or omit results with other keywords. The following example shows a more detailed query that you can use when performing a text search.&lt;/p&gt;
&lt;p&gt;In this example, t_log is the source table, and text_index is the text index. The query finds records that either contain:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Both the words &#39;&amp;lt;WARNING&amp;gt;&#39; and &#39;validate&#39;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Only the word &#39;[Log]&#39; and does not contain &#39;validateDependencies&#39;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT * FROM t_log where (
   id IN (SELECT doc_id FROM text_index WHERE token = v_txtindex.StemmerCaseSensitive(&amp;#39;&amp;lt;WARNING&amp;gt;&amp;#39;))
      AND (   id IN (SELECT doc_id FROM text_index WHERE token = v_txtindex.StemmerCaseSensitive(&amp;#39;validate&amp;#39;)
      OR id IN (SELECT doc_id FROM text_index WHERE token = v_txtindex.StemmerCaseSensitive(&amp;#39;[Log]&amp;#39;)))
      AND NOT (id IN (SELECT doc_id FROM text_index WHERE token = v_txtindex.StemmerCaseSensitive(&amp;#39;validateDependencies&amp;#39;))));
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This query returns the following results:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;id  |   date     |                               text
----+------------+------------------------------------------------------------------------------------------------
11  | 2014-05-04 | 11:00:49.568 unknown:0x7f9207607702 [Log] &amp;lt;WARNING&amp;gt; validate: Object 4503 via fld num_all_roles
13  | 2014-05-04 | 11:00:49.568 unknown:0x7f9207607706 [Log] &amp;lt;WARNING&amp;gt; validate: Object 45035 refers to root_i3
14  | 2014-05-04 | 11:00:49.568 unknown:0x7f9207607708 [Log] &amp;lt;WARNING&amp;gt; validate: Object 4503 refers to int_2
17  | 2014-05-04 | 11:00:49.568 unknown:0x7f9207607700 [Txn] &amp;lt;WARNING&amp;gt; Begin validate Txn: fff0ed17 catalog editor
(4 rows)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Admin: Dropping a text index</title>
      <link>/en/admin/using-text-search/dropping-text-index/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/using-text-search/dropping-text-index/</guid>
      <description>
        
        
        &lt;p&gt;Dropping a text index removes the specified text index from the database.&lt;/p&gt;
&lt;p&gt;You can drop a text index when:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;It is no longer queried frequently.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;An administrative task needs to be performed on the source table and requires the text index to be dropped.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Dropping the text index does not drop the source table associated with the text index. However, if you drop the source table associated with a text index, that text index is also dropped. The database considers the text index a dependent object.&lt;/p&gt;
&lt;p&gt;The following example illustrates how to drop a text index named text_index:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; DROP TEXT INDEX text_index;
DROP INDEX
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Admin: Stemmers and tokenizers</title>
      <link>/en/admin/using-text-search/stemmers-and-tokenizers/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/using-text-search/stemmers-and-tokenizers/</guid>
      <description>
        
        
        &lt;p&gt;OpenText™ Analytics Database provides default stemmers and tokenizers. You can also create your own custom stemmers and tokenizers. The following topics explain the default stemmers and tokenizers, and the requirements for creating custom stemmers and tokenizers.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/admin/using-text-search/stemmers-and-tokenizers/stemmers/#&#34;&gt;Stemmers&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/admin/using-text-search/stemmers-and-tokenizers/tokenizers/#&#34;&gt;Tokenizers&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/admin/using-text-search/stemmers-and-tokenizers/configuring-tokenizer/#&#34;&gt;Configuring a tokenizer&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../en/admin/using-text-search/stemmers-and-tokenizers/requirements-custom-stemmers-and-tokenizers/#&#34;&gt;Requirements for custom stemmers and tokenizers&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
  </channel>
</rss>
