Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set up Oracle Text to index values of multiple columns in Oracle tables

I have a set of Oracle tables that describe information about property owners. Owner names and other text values are stored in multiple fields in multiple related tables, for each owner. I would like to index the contents of these fields. My goal is to provide a single field where a user can enter keywords to locate owners.

How do I set up Oracle Text to accomplish this?

like image 213
JoshL Avatar asked Feb 21 '09 00:02

JoshL


People also ask

Can you apply index to multiple columns?

An index can be defined on more than one column of a table. For example, if you have a table of this form: CREATE TABLE test2 ( major int, minor int, name varchar );

Can we create index on multiple columns in Oracle?

You can create a composite index on multiple columns up to a maximum of 32 columns. A composite index key cannot exceed roughly one-half (minus some overhead) of the available space in the data block. Oracle Database automatically creates an index to enforce a UNIQUE or PRIMARY KEY constraint.

Can a table have multiple indexes for multiple columns?

It is possible for an index to have two or more columns. Multi column indexes are also known as compound or concatenated indexes. Let us look at a query that could use two different indexes on the table based on the WHERE clause restrictions. We first create these indexes.

What is it called when index is created on multiple columns then index?

The two types of indexes are single-column indexes and multicolumn indexes. A single-column index is an index based on the values in one column of a table. A multicolumn index is an index based on the values in multiple columns of a table.


1 Answers

You'll just need to create a multiple datastore preference and pass it in as a parameter to the index.

begin
ctx_ddl.create_preference('my_multi', 'MULTI_COLUMN_DATASTORE');
ctx_ddl.set_attribute('my_multi', 'columns', 'column1, column2, column3');
end;


create index myindex on mytable(docs) 
  indextype is ctxsys.context 
  parameters ('DATASTORE my_multi');

http://download.oracle.com/docs/cd/B19306_01/text.102/b14217/ind.htm#sthref281

like image 97
Nick Avatar answered Nov 11 '22 12:11

Nick