NDATA Section
For fields containing data to be indexed for name searching, you can specify them exclusively by adding NDATA sections to section groups of type BASIC_SECTION_GROUP, HTML_SECTION_GROUP, or XML_SECTION_GROUP.
Users can synthesize textual documents, which contain name data, by using two possible datastores: MULTI_COLUMN_DATASTORE or USER_DATASTORE. The following example uses MULTI_COLUMN_DATASTORE to pick up relevant columns containing the name data for indexing:
create table people(firstname varchar2(80), surname varchar2(80));
insert into people values('John', 'Smith');
commit;
begin
ctx_ddl.create_preference('nameds', 'MULTI_COLUMN_DATASTORE');
ctx_ddl.set_attribute('nameds', 'columns', 'firstname,surname');
end;
/
This example produces the following virtual text for indexing:
<FIRSTNAME>
John
</FIRSTNAME>
<SURNAME>
Smith
</SURNAME>
You can then create NDATA sections for FIRSTNAME and SURNAME sections:
begin
ctx_ddl.create_section_group('namegroup', 'BASIC_SECTION_GROUP');
ctx_ddl.add_ndata_section('namegroup', 'FIRSTNAME', 'FIRSTNAME');
ctx_ddl.add_ndata_section('namegroup', 'SURNAME', 'SURNAME');
end;
/
Next, create the index by using the datastore preference and section group preference that you created earlier:
create index peopleidx on people(firstname) indextype is ctxsys.context
parameters('section group namegroup datastore nameds');
NDATA sections support both single- and multibyte data with character- and term-based limitations. NDATA section data that is indexed is constrained as follows:
-
The number of characters in a single, whitespace-delimited term: 511
-
The number of whitespace-delimited terms: 255
-
The total number of characters, including whitespaces: 511