DBA Data[Home] [Help]

PACKAGE BODY: APPS.DOM_DOC_TEXT_PVT

Source


1 PACKAGE BODY DOM_DOC_TEXT_PVT AS
2 /* $Header: DOMVIDXB.pls 120.0 2006/04/05 06:06:11 dedatta noship $ */
3 
4 G_PKG_NAME	CONSTANT  VARCHAR2(30)  :=  'DOM_TEXT_PVT';
5 
6 -- -----------------------------------------------------------------------------
7 --  				Private Globals
8 -- -----------------------------------------------------------------------------
9 
10 g_Ctx_Schema		CONSTANT  VARCHAR2(30)  :=  'CTXSYS';
11 --g_Apps_Schema		VARCHAR2(30);
12 g_Prod_Schema			VARCHAR2(30);
13 g_Index_Owner			VARCHAR2(30);
14 g_Pref_Owner			VARCHAR2(30);
15 
16 g_installed		BOOLEAN;
17 g_inst_status		VARCHAR2(1);
18 g_industry		VARCHAR2(1);
19 
20 --g_Debug		VARCHAR2(1)  :=  NVL(fnd_profile.value('AFLOG_ENABLED'), 'N');
21 --g_debug		NUMBER  :=  NVL(FND_PROFILE.VALUE('INV_DEBUG_TRACE'), 0);
22 
23 -- Log mode
24 g_Log_Mode		VARCHAR2(30)  :=  NULL;
25 g_Conc_Req_flag		BOOLEAN  :=  TRUE;
26 g_Log_Sqlplus_Flag	BOOLEAN  :=  FALSE;
27 g_Log_File_Flag		BOOLEAN  :=  TRUE;
28 g_Log_Dbdrv_Flag	BOOLEAN  :=  FALSE;
29 
30 g_Msg_Text		VARCHAR2(1000);
31 
32 -- Log directory
33 g_Log_Dir		v$parameter.value%TYPE;
34 g_Dump_Dir		v$parameter.value%TYPE;
35 
36 -- Log files for Sqlplus
37 g_Log_File		VARCHAR2(30)  :=  'dom_doc_text_tl_srs.log';
38 g_Out_File		VARCHAR2(30)  :=  'dom_doc_text_tl_srs.out';
39 
40 -- -----------------------------------------------------------------------------
41 --				  Log_Line
42 -- -----------------------------------------------------------------------------
43 
44 PROCEDURE Log_Line ( p_Buffer  IN  VARCHAR2 )
45 IS
46 BEGIN
47    IF ( g_Log_File_Flag ) THEN
48       FOR l IN 0 .. ( FLOOR( (NVL(LENGTH(p_Buffer),0) - 1)/240 ) ) LOOP
49          FND_FILE.Put_Line (FND_FILE.Log, SUBSTRB(p_Buffer, l*240 + 1, 240));
50       END LOOP;
51    END IF;
52 
53    IF ( g_Log_Sqlplus_Flag ) THEN
54       FOR l IN 0 .. ( FLOOR( (NVL(LENGTH(p_Buffer),0) - 1)/255 ) ) LOOP
55          --DBMS_OUTPUT.Put_Line( SUBSTR(p_Buffer, l*255 + 1, 255) );
56          NULL;
57       END LOOP;
58    END IF;
59 
60    IF ( g_Log_Dbdrv_Flag ) THEN
61       --IF ( (INSTR(p_Buffer, 'Error:') + INSTR(p_Buffer, 'Warning:')) > 0 ) THEN
62       IF (    ( INSTR(p_Buffer, 'Error:') > 0 )
63            OR ( INSTR(p_Buffer, 'Warning:') > 0 )
64            OR ( INSTR(p_Buffer, 'Executing:') > 0 )
65            OR ( INSTR(p_Buffer, 'Done.') > 0 )
66            OR ( INSTR(p_Buffer, 'Upgrade:') > 0 ) )
67       THEN
68          g_Msg_Text := g_Msg_Text || SUBSTRB(p_Buffer, 1, 255) || FND_GLOBAL.Newline;
69       END IF;
70    END IF;
71 
72 EXCEPTION
73 
74 	WHEN others THEN
75 		NULL;
76 
77 END Log_Line;
78 
79 PROCEDURE Out_Line ( p_Buffer  IN  VARCHAR2 )
80 IS
81 BEGIN
82    IF ( g_Log_File_Flag ) THEN
83       FOR l IN 0 .. ( FLOOR( (NVL(LENGTH(p_Buffer),0) - 1)/240 ) ) LOOP
84          FND_FILE.Put_Line (FND_FILE.Log, SUBSTRB(p_Buffer, l*240 + 1, 240));
85       END LOOP;
86    END IF;
87 
88    IF ( g_Log_Sqlplus_Flag ) THEN
89       FOR l IN 0 .. ( FLOOR( (NVL(LENGTH(p_Buffer),0) - 1)/255 ) ) LOOP
90          --DBMS_OUTPUT.Put_Line( SUBSTR(p_Buffer, l*255 + 1, 255) );
91          NULL;
92       END LOOP;
93    END IF;
94 
95    IF ( g_Log_Dbdrv_Flag ) THEN
96       IF ( INSTR(p_Buffer, 'Completed ') > 0 ) THEN
97          g_Msg_Text := g_Msg_Text || SUBSTRB(p_Buffer, 1, 255) || FND_GLOBAL.Newline;
98       END IF;
99    END IF;
100 END Out_Line;
101 
102 -- -----------------------------------------------------------------------------
103 --				  set_Log_Mode
104 -- -----------------------------------------------------------------------------
105 
106 FUNCTION set_Log_Mode ( p_Mode  IN  VARCHAR2 )
107 RETURN VARCHAR2
108 IS
109    l_api_name		CONSTANT  VARCHAR2(30)  :=  'set_Log_Mode';
110 BEGIN
111    g_Log_Mode := p_Mode;
112 
113    g_Log_Sqlplus_Flag := ( INSTR(g_Log_Mode, 'SQLPLUS') > 0 );
114    g_Log_File_Flag    := ( (INSTR(g_Log_Mode, 'FILE') + INSTR(g_Log_Mode, 'SRS')) > 0 );
115    g_Log_Dbdrv_Flag   := ( INSTR(g_Log_Mode, 'DBDRV') > 0 );
116 
117    g_Msg_Text := NULL;
118 
119    -- Determine log directory
120 
121    BEGIN
122       SELECT value INTO g_Dump_Dir
123       FROM v$parameter WHERE name = 'user_dump_dest';
124 
125       SELECT TRANSLATE(LTRIM(value), ',', ' ') INTO g_Log_Dir
126       FROM v$parameter
127       WHERE name = 'utl_file_dir';
128 
129       IF ( g_Log_Dir IS NOT NULL ) THEN
130          IF ( INSTR(g_Log_Dir, ' ') > 0 ) THEN
131             g_Log_Dir := SUBSTRB(g_Log_Dir, 1, INSTR(g_Log_Dir,' ')-1);
132          END IF;
133       END IF;
134 
135    --EXCEPTION
136    --   WHEN others THEN
137    --      Log_Line ('Error determining CTX log directory: ' || SQLERRM);
138    END;
139 
140    IF ( NVL(FND_GLOBAL.CONC_REQUEST_ID,-1) < 0 ) THEN
141       g_Conc_Req_flag := FALSE;
142       FND_FILE.Put_Names (g_Log_File, g_Out_File, g_Log_Dir);
143       Log_Line (l_api_name || ': standalone execution');
144    ELSE
145       Log_Line (l_api_name || ': concurrent request');
146    END IF;
147 
148    Log_Line (l_api_name || ': log mode: ' || g_Log_Mode);
149    Log_Line (l_api_name || ': dump directory: ' || g_Dump_Dir);
150    Log_Line (l_api_name || ': CTX log directory: ' || g_Log_Dir);
151 
152    RETURN (NULL);
153 
154 END set_Log_Mode;
155 
156 PROCEDURE set_Log_Mode ( p_Mode  IN  VARCHAR2 )
157 IS
158    l_output_name	VARCHAR2(255);
159 BEGIN
160    l_output_name := set_Log_Mode (p_Mode);
161 END set_Log_Mode;
162 
163 -- -----------------------------------------------------------------------------
164 --			  Process_Index_Preferences
165 -- -----------------------------------------------------------------------------
166 
167 PROCEDURE Process_Index_Preferences
168 (
169    p_Index_Name		IN           VARCHAR2
170 ,  x_return_status	OUT  NOCOPY  VARCHAR2
171 )
172 IS
173    l_api_name		CONSTANT  VARCHAR2(30)  :=  'Process_Index_Preferences';
174    l_return_status		VARCHAR2(1);
175 
176    tspace_tbl_param		VARCHAR2(256);
177    tspace_idx_param		VARCHAR2(256);
178 
179    Lang_Code			VARCHAR2(4);
180    Lexer_Name			VARCHAR2(30);
181 
182    TYPE Lang_Code_List_type  IS TABLE OF VARCHAR2(4);
183    --TYPE Lang_ISO_List_type   IS TABLE OF VARCHAR2(2);
184 
185    Lang_Code_List    Lang_Code_List_type := Lang_Code_List_type
186                      ( 'US', 'GB', 'NL', 'D', 'DK', 'S', 'N',
187                        'F', 'I', 'E', 'ESA', 'EL',
188                        'JA', 'KO', 'ZHS', 'ZHT' );
189 
190    --Lang_ISO_List     Lang_ISO_List_type :=
191    --                  Lang_ISO_List_type ('EN', '', 'DE', 'SV', 'NO', 'FR', '', '');
192 
193 BEGIN
194    Log_Line (l_api_name || ': begin');
195 
196    l_return_status := G_STATUS_SUCCESS;
197    ------------------------------
198    -- Drop existing preferences
199    ------------------------------
200 
201    Log_Line (l_api_name || ': dropping all existing preferences ...');
202 
203    FOR multi_lexer_rec IN	( SELECT pre_owner, pre_name
204                          	  FROM ctxsys.ctx_preferences
205                          	  WHERE pre_name = 'DOM_DOC_MULTI_LEXER' )
206    LOOP
207       ad_ctx_ddl.drop_preference (multi_lexer_rec.pre_owner ||'.'|| multi_lexer_rec.pre_name);
208    END LOOP;
209 
210    FOR sub_lexer_rec IN		( SELECT pre_owner, pre_name
211                        		  FROM ctxsys.ctx_preferences
212                        		  WHERE pre_name LIKE 'DOM_DOC_LEXER%' )
213    LOOP
214       ad_ctx_ddl.drop_preference (sub_lexer_rec.pre_owner ||'.'|| sub_lexer_rec.pre_name);
215    END LOOP;
216 
217    FOR wordlist_rec IN		( SELECT pre_owner, pre_name
218                        		  FROM ctxsys.ctx_preferences
219                        		  WHERE pre_name = 'DOM_DOC_WORDLIST' )
220    LOOP
221       ad_ctx_ddl.drop_preference (wordlist_rec.pre_owner ||'.'|| wordlist_rec.pre_name);
222    END LOOP;
223 
224    FOR stoplist_rec IN		( SELECT spl_owner, spl_name
225                        		  FROM ctxsys.ctx_stoplists
226                        		  WHERE spl_name = 'DOM_DOC_STOPLIST' )
227    LOOP
228       ad_ctx_ddl.Drop_Stoplist (stoplist_rec.spl_owner || '.DOM_DOC_STOPLIST');
229    END LOOP;
230 
231    FOR section_group_rec IN	( SELECT sgp_owner, sgp_name
232                        		  FROM ctxsys.ctx_section_groups
233                        		  WHERE sgp_name = 'DOM_DOC_SECTION_GROUP' )
234    LOOP
235       ad_ctx_ddl.Drop_Section_Group (section_group_rec.sgp_owner ||'.'|| section_group_rec.sgp_name);
236    END LOOP;
237 
238    FOR datastore_rec IN		( SELECT pre_owner, pre_name
239                        		  FROM ctxsys.ctx_preferences
240                        		  WHERE pre_name = 'DOM_DOC_DATASTORE' )
241    LOOP
242       ad_ctx_ddl.drop_preference (datastore_rec.pre_owner ||'.'|| datastore_rec.pre_name);
243    END LOOP;
244 
245    FOR storage_rec IN		( SELECT pre_owner, pre_name
246                        		  FROM ctxsys.ctx_preferences
247                        		  WHERE pre_name = 'DOM_DOC_STORAGE' )
248    LOOP
249       ad_ctx_ddl.drop_preference (storage_rec.pre_owner ||'.'|| storage_rec.pre_name);
250    END LOOP;
251 
252    ------------------------------
253    -- Create STORAGE preference
254    ------------------------------
255 
256    -- Index tables use the same tablespaces used by other  tables and indexes
257    -- or use logical tablespace for indexes (TRANSACTION_INDEXES).
258 
259    Log_Line (l_api_name || ': querying tablespace parameters ...');
260 
261    SELECT 'tablespace ' || tablespace_name ||
262           ' storage (initial 1M next 1M minextents 1 maxextents unlimited pctincrease 0)'
263      INTO tspace_tbl_param
264    FROM all_tables
265    WHERE owner = g_Prod_Schema AND table_name = 'DOM_DOCUMENTS_IMTEXT_TL';
266 
267 
268    SELECT 'tablespace ' || tablespace_name ||
269           ' storage (initial 1M next 1M minextents 1 maxextents unlimited pctincrease 0)'
270      INTO tspace_idx_param
271    FROM all_indexes
272    WHERE owner = g_Prod_Schema
273      AND index_name = 'DOM_DOCUMENTS_IMTEXT_TL_U1'
274      AND table_name = 'DOM_DOCUMENTS_IMTEXT_TL';
275 
276 
277    Log_Line (l_api_name || ': creating STORAGE preference ...');
278 
279    ad_ctx_ddl.create_preference (g_Pref_Owner || '.DOM_DOC_STORAGE', 'BASIC_STORAGE');
280 
281    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.DOM_DOC_STORAGE',
282                              'I_TABLE_CLAUSE', tspace_tbl_param);
283 
284    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.DOM_DOC_STORAGE',
285                              'K_TABLE_CLAUSE', tspace_tbl_param);
286 
287    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.DOM_DOC_STORAGE',
288                              'R_TABLE_CLAUSE', tspace_tbl_param || ' LOB (data) STORE AS (CACHE)');
289 
290    -- Caching the "data" LOB column is the default (at later versions of Oracle Text).
291    -- For index specific STORAGE preference, setting the clause "lob (data) (cache reads)"
292    -- should be ensured (the "lob .. store as" clause is only for newly added LOB columns).
293    --alter table dr$prd_ctx_index$r modify lob (data) (cache reads);
294 
295    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.DOM_DOC_STORAGE',
296                              'N_TABLE_CLAUSE', tspace_tbl_param);
297 
298    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.DOM_DOC_STORAGE',
299                              'P_TABLE_CLAUSE', tspace_tbl_param);
300 
301    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.DOM_DOC_STORAGE',
302                              'I_INDEX_CLAUSE', tspace_idx_param || ' COMPRESS 2');
303 
304    --ad_ctx_ddl.set_attribute (g_Pref_Owner || '.DOM_DOC_STORAGE',
305    --                          'I_ROWID_INDEX_CLAUSE', tspace_idx_param);
306 
307    --------------------------------
308    -- Create DATASTORE preference
309    --------------------------------
310 
311    Log_Line (l_api_name || ': creating DATASTORE preference ...');
312 
313    ad_ctx_ddl.Create_Preference (g_Pref_Owner || '.DOM_DOC_DATASTORE', 'USER_DATASTORE');
314 
315 
316    /* Commented by Gopi as CLOB output is not required for DOM module*/
317    --ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_DATASTORE', 'OUTPUT_TYPE', 'CLOB');
318    --ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_DATASTORE', 'PROCEDURE', '"DOM_DOC_TEXT_CTX_PKG"."Get_Dom_Text_CLOB"');
319 
320    /* Unommented by Gopi as varchar output is required for DOM module*/
321    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_DATASTORE', 'OUTPUT_TYPE', 'VARCHAR2');
322    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_DATASTORE', 'PROCEDURE', '"DOM_DOC_TEXT_CTX_PKG"."Get_Doc_Text_VARCHAR2"');
323    ------------------------------------
324    -- Create SECTION GROUP preference
325    ------------------------------------
326 
327    --Log_Line (l_api_name || ': creating SECTION_GROUP preference ...');
328 
329    --ad_ctx_ddl.Create_Section_Group (g_Pref_Owner || '.DOM_DOC_STOPLIST', 'AUTO_SECTION_GROUP');
330 
331    -------------------------------
335    Log_Line (l_api_name || ': creating STOPLIST preference ...');
332    -- Create STOPLIST preference
333    -------------------------------
334 
336 
337    -- This should create stoplist equivalent to CTXSYS.EMPTY_STOPLIST
338    ad_ctx_ddl.Create_Stoplist (g_Pref_Owner || '.DOM_DOC_STOPLIST');
339 
340    -------------------------------
341    -- Create WORDLIST preference
342    -------------------------------
343 
344    Log_Line (l_api_name || ': creating WORDLIST preference ...');
345 
346    ad_ctx_ddl.Create_Preference (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'BASIC_WORDLIST');
347 
348    -- Enable prefix indexing to improve performance for wildcard searches
349    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'PREFIX_INDEX', 'TRUE');
350    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'PREFIX_MIN_LENGTH', 2);
351    --ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'PREFIX_LENGTH_MIN', 2);
352    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'PREFIX_MAX_LENGTH', 32);
353    --ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'PREFIX_LENGTH_MAX', 32);
354    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'WILDCARD_MAXTERMS', 5000);
355 
356    -- This option should be TRUE only when left-truncated wildcard searching is expected
357    -- to be frequent and needs to be fast (at the cost of increased index time and space).
358    --
359    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'SUBSTRING_INDEX', 'FALSE');
360 
361    -- WORDLIST attribute defaults: STEMMER: 'ENGLISH'; FUZZY_MATCH: 'GENERIC'
362    -- Use automatic language detection for stemming and fuzzy matching
363    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'STEMMER', 'AUTO');
364    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'FUZZY_MATCH', 'AUTO');
365    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'FUZZY_SCORE', 40);
366    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.DOM_DOC_WORDLIST', 'FUZZY_NUMRESULTS', 120);
367 
368    -----------------------------------------------
369    -- Create language-specific LEXER preferences
370    -----------------------------------------------
371 
372    Log_Line (l_api_name || ': creating language-specific LEXER preferences ...');
373 
374    FOR i IN Lang_Code_List.FIRST .. Lang_Code_List.LAST
375    LOOP
376       Lexer_Name := g_Pref_Owner || '.DOM_DOC_LEXER_' || Lang_Code_List(i);
377 
378       IF ( Lang_Code_List(i) = 'JA' ) THEN
379 
380          -- Use JAPANESE_LEXER if db charset is UTF8, JA16SJIS, or JA16EUC.
381          IF ( DOM_DOC_TEXT_UTIL.get_DB_Version_Num >= 9.0 ) THEN
382             ad_ctx_ddl.Create_Preference (Lexer_Name, 'JAPANESE_LEXER');
383          ELSE
384             ad_ctx_ddl.Create_Preference (Lexer_Name, 'JAPANESE_VGRAM_LEXER');
385          END IF;
386 
387       ELSIF ( Lang_Code_List(i) = 'KO' ) THEN
388 
389          -- Use KOREAN_MORPH_LEXER if db charset is UTF8 or KO16KSC5601.
390          IF ( DOM_DOC_TEXT_UTIL.get_DB_Version_Num >= 9.0 ) THEN
391             ad_ctx_ddl.Create_Preference (Lexer_Name, 'KOREAN_MORPH_LEXER');
392             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'VERB_ADJECTIVE', 'TRUE');
393             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ONE_CHAR_WORD', 'TRUE');
394             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'NUMBER', 'TRUE');
395             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'COMPOSITE', 'NGRAM');
396             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'MORPHEME', 'TRUE');
397             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'HANJA', 'FALSE');
398             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'LONG_WORD', 'TRUE');
399             --ad_ctx_ddl.Set_Attribute (Lexer_Name, 'JAPANESE', 'FALSE');
400             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ENGLISH', 'TRUE');
401             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'TO_UPPER', 'TRUE');
402          ELSE
403 
404             ad_ctx_ddl.Create_Preference (Lexer_Name, 'KOREAN_LEXER');
405             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'VERB', 'TRUE');
406             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ADJECTIVE', 'TRUE');
407             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ADVERB', 'TRUE');
408             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ONECHAR', 'TRUE');
409             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'NUMBER', 'TRUE');
410             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'COMPOSITE', 'TRUE');
411             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'MORPHEME', 'TRUE');
412             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'TOHANGEUL', 'TRUE');
413             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'TOUPPER', 'TRUE');
414          END IF;
415 
416       ELSIF ( Lang_Code_List(i) IN ('ZHS', 'ZHT') ) THEN
417 
418          IF ( DOM_DOC_TEXT_UTIL.get_DB_Version_Num >= 9.2 ) THEN
419             ad_ctx_ddl.Create_Preference (Lexer_Name, 'CHINESE_LEXER');
420          ELSE
421             ad_ctx_ddl.Create_Preference (Lexer_Name, 'CHINESE_VGRAM_LEXER');
422          END IF;
423 
424       ELSE
425          -- All other languages use basic lexer.
426 
427          ad_ctx_ddl.Create_Preference (Lexer_Name, 'BASIC_LEXER');
428 
429          -- The following language-independent attributes are
430          -- common to the BASIC_LEXER preference object.
431 
432          ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_TEXT', 'YES');
433          ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_THEMES', 'NO');
434 
435          -- For printjoin characters include all possible flex segment separators
436          ad_ctx_ddl.Set_Attribute (Lexer_Name, 'PRINTJOINS', '-_*~^+.$#@:|&');
437          ad_ctx_ddl.Set_Attribute (Lexer_Name, 'CONTINUATION', '-\');
438          ad_ctx_ddl.Set_Attribute (Lexer_Name, 'PUNCTUATIONS', '.?!');
439 
440          -- The default values for numjoin and numgroup are determined by
441          -- the NLS initialization parameters that are specified for the database.
445          -- Stem indexing stems tokens at indexing time to a single base form in addition
442          --ad_ctx_ddl.Set_Attribute (Lexer_Name, 'NUMGROUP', ',');
443          --ad_ctx_ddl.Set_Attribute (Lexer_Name, 'NUMJOIN', '.');
444 
446          -- to the normal forms. This enables better query performance for stem ($) queries.
447 
448          -- Disable stem indexing to improve index creation performance.
449          -- This would not affect stem expansion (with $) at query time.
450          --
451          --IF ( DOM_DOC_TEXT_UTIL.get_DB_Version_Num >= 9.2 ) THEN
452          --   IF ( Lang_Code_List(i) IN ('US', 'GB') ) THEN
453          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'ENGLISH');
454          --   ELSIF ( Lang_Code_List(i) = 'NL' ) THEN
455          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'DUTCH');
456          --   ELSIF ( Lang_Code_List(i) = 'D' ) THEN
457          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'GERMAN');
458          --   ELSIF ( Lang_Code_List(i) = 'F' ) THEN
459          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'FRENCH');
460          --   ELSIF ( Lang_Code_List(i) = 'I' ) THEN
461          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'ITALIAN');
462          --   ELSIF ( Lang_Code_List(i) IN ('E', 'ESA') ) THEN
463          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'SPANISH');
464          --   END IF;
465          --END IF;
466 
467          -- Language-specific attribute values for BASIC_LEXER preference object
468 
469          IF ( Lang_Code_List(i) = 'NL' ) THEN
470             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'COMPOSITE', 'DUTCH');
471 
472          ELSIF ( Lang_Code_List(i) = 'D' ) THEN
473             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'COMPOSITE', 'GERMAN');
474             -- Basic lexer in 8.1.7 allows the MIXED_CASE to be FALSE when COMPOSITE is set.
475             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'MIXED_CASE', 'NO');
476             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ALTERNATE_SPELLING', 'GERMAN');
477 
478          ELSIF ( Lang_Code_List(i) = 'DK' ) THEN
479             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ALTERNATE_SPELLING', 'DANISH');
480 
481          ELSIF ( Lang_Code_List(i) = 'S' ) THEN
482             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ALTERNATE_SPELLING', 'SWEDISH');
483 
484          ELSIF ( Lang_Code_List(i) = 'N' ) THEN
485             -- Both Norwegian and Danish use the same special characters that are
486             -- rendered alternatively as "aa", "ae", and "oe".
487             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ALTERNATE_SPELLING', 'DANISH');
488 
489          ELSIF ( Lang_Code_List(i) = 'F' ) THEN
490             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'BASE_LETTER', 'YES');
491 
492          ELSE
493             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ALTERNATE_SPELLING', 'NONE');
494 
495          END IF;
496       END IF;
497 
498    END LOOP;  -- Lang_Code_List
499 
500    ----------------------------------
501    -- Create MULTI_LEXER preference
502    ----------------------------------
503 
504    Log_Line (l_api_name || ': creating MULTI_LEXER preference ...');
505 
506    ad_ctx_ddl.Create_Preference (g_Pref_Owner || '.DOM_DOC_MULTI_LEXER', 'MULTI_LEXER');
507 
508    FOR i IN Lang_Code_List.FIRST .. Lang_Code_List.LAST
509    LOOP
510       Lexer_Name := g_Pref_Owner || '.DOM_DOC_LEXER_' || Lang_Code_List(i);
511 
512       -- The language column is case-independent, and can contain either the NLS name
513       -- or abbreviation of the language.  If the table uses some other value for the
514       -- language, that alternate value needs to be specified as the fourth argument
515       -- when adding the sub lexers:
516 
517       IF ( Lang_Code_List(i) = 'US' ) THEN
518          -- US English lexer to handle everything else.
519          ad_ctx_ddl.Add_Sub_Lexer ( g_Pref_Owner || '.DOM_DOC_MULTI_LEXER', 'DEFAULT'
520                                   , g_Pref_Owner || '.DOM_DOC_LEXER_US' );
521       ELSE
522          ad_ctx_ddl.Add_Sub_Lexer
523          (  lexer_name    =>  g_Pref_Owner || '.DOM_DOC_MULTI_LEXER'
524          ,  language      =>  Lang_Code_List(i)
525          ,  sub_lexer     =>  Lexer_Name
526          --,  alt_value     =>  Lang_ISO_List(i)
527          );
528       END IF;
529 
530    END LOOP;
531 
532    x_return_status := l_return_status;
533 
534    Log_Line (l_api_name || ': end');
535 
536 EXCEPTION
537 
538    WHEN G_EXC_ERROR THEN
539       x_return_status := G_STATUS_ERROR;
540 
541    WHEN others THEN
542 
543       Log_Line (l_api_name || ': Error: ' || SQLERRM);
544       x_return_status := G_STATUS_UNEXP_ERROR;
545 
546 
547 END Process_Index_Preferences;
548 
549 -- -----------------------------------------------------------------------------
550 --			   Process_Doc_Text_Index
551 -- -----------------------------------------------------------------------------
552 
553 PROCEDURE Process_Doc_Text_Index
554 (
555    p_Index_Name		IN           VARCHAR2
556 ,  p_Action		IN           VARCHAR2
557 ,  x_return_status	OUT  NOCOPY  CLOB
558 )
559 IS
560    l_api_name		CONSTANT  VARCHAR2(30)  :=  'Process_Doc_Text_Index';
561    l_return_status		VARCHAR2(1);
562    ctx_Log_File_Name		VARCHAR2(512)   :=  NULL;
563 
564    l_index_exists		BOOLEAN         :=  FALSE;
565    l_index_valid		BOOLEAN         :=  TRUE;
566 
567    l_create_index		BOOLEAN         :=  TRUE;
568    l_drop_index			BOOLEAN         :=  FALSE;
569 
570    l_rows_processed		INTEGER;
571 
572    -- Limit the indexing memory in case the default parameter max value is higher.
573    --l_Index_Memory		ctx_parameters.par_value%TYPE  :=  '67108864'; -- '64M'
577    l_idx_docid_count		NUMBER;
574    l_Index_Memory		ctx_parameters.par_value%TYPE  :=  '134217728'; -- '128M'
575    l_Index_Memory_Max		ctx_parameters.par_value%TYPE;
576 
578    l_idx_status			VARCHAR2(256);
579 
580    l_index_populate		VARCHAR2(30)    :=  'POPULATE';
581 
582    -- Use parallel indexing when this issue is resolved
583    c_parallel_clause	CONSTANT  VARCHAR2(30)  :=  'PARALLEL 4';
584    --c_parallel_clause	CONSTANT  VARCHAR2(30)  :=  NULL;
585 
586    l_index_parallel		VARCHAR2(30)    :=  NULL;
587    l_error_text VARCHAR2 (550) := 'ERROR:';
588    sql_stmt			VARCHAR2(32767);
589 BEGIN
590 
591    Log_Line (l_api_name || ': begin: Index_Name=' || p_Index_Name || ' Action=' || p_Action);
592 
593    l_return_status := G_STATUS_SUCCESS;
594 
595    IF ( p_Action NOT IN ('CREATE', 'REBUILD', 'UPGRADE', 'DROP') ) THEN
596       Log_Line (l_api_name || ': Error: invalid value for parameter p_Action: ' || p_Action);
597       RAISE G_EXC_ERROR;
598    END IF;
599 
600    -- Check for existing indexes in the DOM product, APPS Universal, and interMedia schemas.
601    --
602    FOR index_rec IN ( SELECT owner, index_name, status, domidx_status, domidx_opstatus
603                       FROM all_indexes
604                       WHERE ( owner = g_Prod_Schema OR owner = USER OR owner = g_Ctx_Schema )
605                         AND table_name = 'DOM_DOCUMENTS_IMTEXT_TL'
606                         AND index_name = p_Index_Name )
607    LOOP
608       -- Check index schema
609       --
610 
611       IF ( index_rec.owner <> g_Index_Owner )
612       THEN
613          Log_Line (l_api_name || ': Error: index exists in wrong schema: ' || index_rec.owner);
614          BEGIN
615             Log_Line (l_api_name || ': dropping index: ' || index_rec.owner || '.' || p_Index_Name);
616             EXECUTE IMMEDIATE 'DROP INDEX ' || index_rec.owner || '.' || p_Index_Name || ' FORCE';
617          EXCEPTION
618             WHEN others THEN
619                Log_Line (l_api_name || ': Error: DROP INDEX ' || index_rec.owner || '.' || p_Index_Name || ' FORCE: ' || SQLERRM);
620                l_return_status := G_STATUS_ERROR;
621          END;
622 
623       ELSE
624          l_index_exists := TRUE;
625 
626          -- Check status of an existing index, if any.
627          --
628          IF ( (NVL(index_rec.status, 'FAILED') <> 'VALID') OR
629               (NVL(index_rec.domidx_status, 'FAILED') <> 'VALID') OR
630               (NVL(index_rec.domidx_opstatus, 'FAILED') <> 'VALID') )
631          THEN
632             l_index_valid := FALSE;
633             Log_Line (l_api_name || ': Warning: existing index status is invalid:'
634                       || ' status=' || index_rec.status
635                       || ' domidx_status=' || index_rec.domidx_status
636                       || ' domidx_opstatus=' || index_rec.domidx_opstatus);
637          ELSE
638             Log_Line (l_api_name || ': valid index exists: ' || index_rec.owner || '.' || p_Index_Name);
639          END IF;
640 
641       END IF;  -- index owner
642 
643    END LOOP;  -- check for any existing indexes
644 
645    IF ( l_return_status NOT IN (G_STATUS_SUCCESS, G_STATUS_WARNING) ) THEN
646       RAISE G_EXC_ERROR;
647    END IF;
648 
649    --   x_return_status := l_return_status;
650 
651    -- Set indexing flags depending on the action and the index status
652 
653    IF ( p_Action = 'CREATE' ) THEN
654       IF ( l_index_exists ) THEN
655          IF ( l_index_valid ) THEN
656             Log_Line (l_api_name || ': Error: cannot execute ' || p_Action || ' because the index exists.');
657             RAISE G_EXC_ERROR;
658          ELSE
659             l_drop_index := TRUE;
660          END IF;
661       END IF;
662 
663    ELSIF ( p_Action = 'REBUILD' ) THEN
664       l_drop_index := l_index_exists;
665 
666    ELSIF ( p_Action = 'UPGRADE' ) THEN
667       IF ( l_index_exists ) THEN
668          IF ( l_index_valid ) THEN
669             Log_Line (l_api_name || ': Upgrade: skipping index creation because valid index exists.');
670             l_create_index := FALSE;
671          ELSE
672             l_drop_index := TRUE;
673          END IF;
674       END IF;
675 
676    ELSIF ( p_Action = 'DROP' ) THEN
677       l_create_index := FALSE;
678       IF ( l_index_exists ) THEN
679          l_drop_index := TRUE;
680       ELSE
681          Log_Line (l_api_name || ': Warning: cannot execute ' || p_Action || ' because the index does not exist.');
682          l_return_status := G_STATUS_WARNING;
683       END IF;
684 
685    END IF;  -- Action
686 
687 
688    IF ( l_drop_index ) THEN
689       BEGIN
690          Log_Line (l_api_name || ': dropping index: ' || g_Index_Owner || '.' || p_Index_Name);
691          EXECUTE IMMEDIATE 'DROP INDEX ' || g_Index_Owner || '.' || p_Index_Name || ' FORCE';
692          IF ( l_index_valid ) THEN
693             Log_Line (l_api_name || ': existing index has been successfully dropped.');
694             Out_Line ('Existing index has been successfully dropped: ' || g_Index_Owner || '.' || p_Index_Name);
695          ELSE
696             Log_Line (l_api_name || ': invalid index has been dropped.');
697             Out_Line ('Invalid index has been dropped: ' || g_Index_Owner || '.' || p_Index_Name);
698          END IF;
699       EXCEPTION
700          WHEN others THEN
701             Log_Line (l_api_name || ': Error: DROP INDEX ' || g_Index_Owner || '.' || p_Index_Name || ' FORCE: ' || SQLERRM);
702             l_return_status := G_STATUS_ERROR;
703       END;
704    END IF;  -- drop index
705 
706    IF ( l_return_status NOT IN (G_STATUS_SUCCESS, G_STATUS_WARNING) ) THEN
707       RAISE G_EXC_ERROR;
708    END IF;
709 
710    -- Build index
711 
715       --ctxsys.CTX_ADM.Set_Parameter ('MAX_INDEX_MEMORY', l_Index_Memory);
712    IF ( l_create_index ) THEN
713 
714       -- Determine index memory parameter value
716       BEGIN
717          SELECT par_value INTO l_Index_Memory_Max
718          FROM ctx_parameters
719          WHERE par_name = 'MAX_INDEX_MEMORY';
720       EXCEPTION
721          WHEN no_data_found THEN
722             Log_Line (l_api_name || ': Error: MAX_INDEX_MEMORY parameter record not found.');
723             RAISE G_EXC_ERROR;
724       END;
725 
726       IF ( TO_NUMBER(l_Index_Memory) > TO_NUMBER(l_Index_Memory_Max) ) THEN
727          l_Index_Memory := l_Index_Memory_Max;
728       END IF;
729 
730       Log_Line (l_api_name || ': CTX index_memory: ' || l_Index_Memory);
731 
732       -- Decide whether parallel indexing can be used, depending on DB version.
733 
734       IF ( DOM_DOC_TEXT_UTIL.get_DB_Version_Num >= 9.2 ) THEN
735          l_index_parallel := c_parallel_clause;
736          Log_Line (l_api_name || ': DB version: ' || DOM_DOC_TEXT_UTIL.get_DB_Version_Str || ', using parallel clause: ' || l_index_parallel);
737       END IF;
738 
739       -- Start logging indexing progress
740 
741       IF ( g_Log_Dir IS NOT NULL ) THEN
742          BEGIN
743             Log_Line (l_api_name || ': CTX Log_Directory: ' || g_Log_Dir);
744             ctxsys.CTX_ADM.Set_Parameter ( 'LOG_DIRECTORY', g_Log_Dir );
745             Log_Line (l_api_name || ': CTX Start_Log');
746             CTX_OUTPUT.Start_Log ( LOWER(p_Index_Name) || '.log' );
747             ctx_Log_File_Name := CTX_OUTPUT.LogFileName;
748             Log_Line (l_api_name || ': CTX LogFileName:   ' || ctx_Log_File_Name);
749          EXCEPTION
750             WHEN others THEN
751                Log_Line (l_api_name || ': Warning: CTX Start_Log: ' || SQLERRM);
752                l_return_status := G_STATUS_WARNING;
753          END;
754       END IF;
755 
756       -- Choose indexing method
757       --IF ( ) THEN
758       --   l_index_populate := 'NOPOPULATE';
759       --END IF;
760 
761       IF ( l_create_index ) THEN
762       BEGIN
763 
764          DOM_DOC_TEXT_UTIL.Set_Context ('CREATE_INDEX');
765 
766          sql_stmt :=
767             'CREATE INDEX ' || g_Index_Owner || '.' || p_Index_Name              ||
768             ' ON ' || g_Prod_Schema || '.DOM_DOCUMENTS_IMTEXT_TL (text)               ' ||
769             ' INDEXTYPE IS CTXSYS.context                                      ' ||
770             ' PARAMETERS                                                       ' ||
771             ' (''DATASTORE      ' || g_Pref_Owner || '.DOM_DOC_DATASTORE      ' ||
772             '  WORDLIST         ' || g_Pref_Owner || '.DOM_DOC_WORDLIST       ' ||
773             '  STOPLIST         ' || g_Pref_Owner || '.DOM_DOC_STOPLIST       ' ||
774             '  LEXER            ' || g_Pref_Owner || '.DOM_DOC_MULTI_LEXER    ' ||
775             '  LANGUAGE COLUMN  language                                       ' ||
776             --'  SECTION GROUP    ' || g_Pref_Owner || '.DOM_DOC_STOPLIST  ' ||
777             '  SECTION GROUP    CTXSYS.NULL_SECTION_GROUP  '                     ||
778             '  STORAGE          ' || g_Pref_Owner || '.DOM_DOC_STORAGE        ' ||
779             '  MEMORY           ' || l_Index_Memory ||
780             --'  ' || l_index_populate ||
781             ' '')' ;
782 --	    || '  ' || l_index_parallel ;
783 
784          Log_Line (l_api_name || ': creating index ' || g_Index_Owner || '.' || p_Index_Name || ' ...');
785          Log_Line (l_api_name || ': sql_stmt = ' || sql_stmt || ' /* End SQL */');
786 
787          EXECUTE IMMEDIATE sql_stmt;
788 
789          Log_Line (l_api_name || ': done creating index.');
790 
791       EXCEPTION
792 
793          WHEN others THEN
794             Log_Line (l_api_name || ': Error creating index ' || g_Index_Owner || '.' || p_Index_Name || ': ' || SQLERRM);
795 
796             -- Drop the index in case of an error during index creation to prevent the table lock.
797             BEGIN
798                EXECUTE IMMEDIATE 'DROP INDEX ' || g_Index_Owner || '.' || p_Index_Name || ' FORCE';
799             EXCEPTION
800                WHEN others THEN
801                   Log_Line (l_api_name || ': Error: DROP INDEX ' || g_Index_Owner || '.' || p_Index_Name || ' FORCE: ' || SQLERRM);
802 
803                  RAISE G_EXC_ERROR;
804             END;
805 
806             RAISE G_EXC_ERROR;
807 
808       END;  -- execute sql
809       END IF;  -- create index
810 /*
811       Log_Line (l_api_name || ': calling Incremental_Sync');
812 
813       DOM_DOC_TEXT_UTIL.Incremental_Sync
814       (
815          p_Index_Name      =>  p_Index_Name
816       ,  p_batch_size      =>  40000
817       ,  x_rows_processed  =>  l_rows_processed
818       ,  x_return_status   =>  l_return_status
819       );
820 */
821       -- End logging
822 
823       IF ( ctx_Log_File_Name IS NOT NULL ) THEN
824          BEGIN
825             CTX_OUTPUT.End_Log;
826             Log_Line (l_api_name || ': CTX End_Log');
827          EXCEPTION
828             WHEN others THEN
829                Log_Line (l_api_name || ': Warning: CTX End_Log: ' || SQLERRM);
830                l_return_status := G_STATUS_WARNING;
831          END;
832       END IF;
833 
834        Log_Line (l_api_name || 'Completed building Document Management Text Index.');
835 
836       -- Check the created index status
837 
838          Log_Line (l_api_name || 'Checking Status of Document Management Text Index.');
839 
840          SELECT idx_docid_count, idx_status
841            INTO l_idx_docid_count, l_idx_status
842          FROM ctxsys.ctx_indexes
843          WHERE idx_owner = g_Index_Owner AND idx_name = 'DOM_IMTEXT_TL_CTX1'
847          IF NOT( l_idx_status = 'INDEXED' ) THEN
844            AND idx_table = 'DOM_DOCUMENTS_IMTEXT_TL';
845 
846 
848             Log_Line (l_api_name || ': Error: Index status is ' || l_idx_status || '.');
849             l_return_status := G_STATUS_ERROR;
850          END IF;
851 
852          IF ( NVL(l_idx_docid_count, 0) = 0 ) THEN
853             Log_Line (l_api_name || ': Error: Indexed document count is ' || TO_CHAR(l_idx_docid_count) || '.');
854             l_return_status := G_STATUS_ERROR;
855          END IF;
856 
857          IF ( l_return_status NOT IN (G_STATUS_SUCCESS, G_STATUS_WARNING) ) THEN
858             RAISE G_EXC_ERROR;
859          END IF;
860 
861 
862 
863    END IF;  -- build index
864 
865    x_return_status := l_return_status;
866    Log_Line (l_api_name || ': end');
867 
868 EXCEPTION
869 
870    WHEN G_EXC_ERROR THEN
871       x_return_status := G_STATUS_ERROR;
872 
873    WHEN others THEN
874       Log_Line (l_api_name || ': Error: ' || SQLERRM);
875       x_return_status := G_STATUS_UNEXP_ERROR;
876 
877 END Process_Doc_Text_Index;
878 
879 -- -----------------------------------------------------------------------------
880 --			     Build_Doc_Text_Index
881 -- -----------------------------------------------------------------------------
882 
883 PROCEDURE Build_Doc_Text_Index
884 (
885    ERRBUF		OUT  NOCOPY  VARCHAR2
886 ,  RETCODE		OUT  NOCOPY  NUMBER
887 ,  p_Action		IN           VARCHAR2
888 )
889 IS
890    l_api_name		CONSTANT  VARCHAR2(30)  :=  'Build_Doc_Text_Index';
891    l_Index_Name			VARCHAR2(30)    :=  'DOM_IMTEXT_TL_CTX1';
892    l_return_status		VARCHAR2(1);
893 BEGIN
894    Log_Line (l_api_name || ': begin: Action=' || p_Action);
895 
896    IF ( g_Log_Mode IS NULL ) THEN
897       set_Log_Mode ('FILE');
898    END IF;
899 
900    l_return_status := G_STATUS_SUCCESS;
901 
902    IF ( p_Action IN ('CREATE', 'REBUILD', 'UPGRADE') ) THEN
903       Log_Line (l_api_name || ': calling Process_Index_Preferences ...');
904 
905       Process_Index_Preferences
906       (
907          p_Index_Name     =>  l_Index_Name
908       ,  x_return_status  =>  l_return_status
909       );
910 
911       IF ( l_return_status NOT IN (G_STATUS_SUCCESS, G_STATUS_WARNING) ) THEN
912          RAISE G_EXC_ERROR;
913       END IF;
914 
915       Out_Line ('Re-created Text Index preferences.');
916    END IF;
917 
918    Log_Line (l_api_name || ': calling Process_Doc_Text_Index ...');
919 
920    Process_Doc_Text_Index
921    (
922       p_Index_Name     =>  l_Index_Name
923    ,  p_Action         =>  p_Action
924    ,  x_return_status  =>  l_return_status
925    );
926 
927    IF ( l_return_status NOT IN (G_STATUS_SUCCESS, G_STATUS_WARNING) ) THEN
928       RAISE G_EXC_ERROR;
929    END IF;
930 
931    -- Assign conc request return code
932 
933    IF ( l_return_status = G_STATUS_SUCCESS ) THEN
934       RETCODE := G_RETCODE_SUCCESS;
935       ERRBUF  := FND_MESSAGE.Get_String('DOM', 'DOM_CP_SUCCESS');
936    ELSIF ( l_return_status = G_STATUS_WARNING ) THEN
937       RETCODE := G_RETCODE_WARNING;
938       ERRBUF  := FND_MESSAGE.Get_String('DOM', 'DOM_CP_WARNING');
939    ELSE
940       RETCODE := G_RETCODE_ERROR;
941       ERRBUF  := FND_MESSAGE.Get_String('DOM', 'DOM_CP_FAILURE');
942    END IF;
943 
944    IF NOT(g_Conc_Req_flag) THEN
945       FND_FILE.Close;
946    END IF;
947 
948    Log_Line (l_api_name || ': end');
949 
950 EXCEPTION
951 
952    WHEN G_EXC_ERROR THEN
953       Log_Line (l_api_name || ': Error.');
954       RETCODE := G_RETCODE_ERROR;
955       ERRBUF  := FND_MESSAGE.Get_String('EGO', 'DOM_CP_FAILURE');
956       --ERRBUF  := 'Build of CM Text Index failed. Please check error messages for further details.';
957 
958       IF NOT(g_Conc_Req_flag) THEN
959          FND_FILE.Close;
960       END IF;
961 
962    WHEN others THEN
963       Log_Line (l_api_name || ': Unexpected Error: ' || SQLERRM);
964       RETCODE := G_RETCODE_ERROR;
965       ERRBUF  := 'Build of CM Text Index failed due to unexpected error. Please check error messages for further details.';
966 
967       IF NOT(g_Conc_Req_flag) THEN
968          FND_FILE.Close;
969       END IF;
970 
971 END Build_Doc_Text_Index;
972 
973 
974 -- -----------------------------------------------------------------------------
975 --				  get_Msg_Text
976 -- -----------------------------------------------------------------------------
977 
978 FUNCTION get_Msg_Text
979 RETURN VARCHAR2
980 IS
981 BEGIN
982    RETURN (g_Msg_Text);
983 END get_Msg_Text;
984 
985 -- *****************************************************************************
986 -- **                      Package initialization block                       **
987 -- *****************************************************************************
988 
989 BEGIN
990 
991    -- Get DOM product schema name
992    --
993    g_installed := FND_INSTALLATION.Get_App_Info ('DOM', g_inst_status, g_industry, g_Prod_Schema);
994 
995    g_Index_Owner := g_Prod_Schema;
996    g_Pref_Owner  := g_Prod_Schema;
997 
998 END DOM_DOC_TEXT_PVT;