88:
89: x_return_status := 'S';
90:
91: request_id := get_request_id('OKCCHRCRCTX');
92: fnd_file.put_line(fnd_file.log,'OKC_K_HEADERS_TL_CTX text index creation started');
93:
94: BEGIN
95: fnd_file.put_line(fnd_file.log,'Checking OKC_CHR_KEYWORD_PVT package exists or not...');
96: SELECT owner INTO apps
91: request_id := get_request_id('OKCCHRCRCTX');
92: fnd_file.put_line(fnd_file.log,'OKC_K_HEADERS_TL_CTX text index creation started');
93:
94: BEGIN
95: fnd_file.put_line(fnd_file.log,'Checking OKC_CHR_KEYWORD_PVT package exists or not...');
96: SELECT owner INTO apps
97: FROM sys.dba_objects
98: WHERE object_name = 'OKC_CHR_KEYWORD_PVT'
99: AND object_type = 'PACKAGE';
96: SELECT owner INTO apps
97: FROM sys.dba_objects
98: WHERE object_name = 'OKC_CHR_KEYWORD_PVT'
99: AND object_type = 'PACKAGE';
100: fnd_file.put_line(fnd_file.log,'OKC_CHR_KEYWORD_PVT package exists');
101: fnd_file.put_line(fnd_file.log,'OKC_CHR_KEYWORD_PVT package owner is '||apps);
102:
103: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 1, 13);
104: EXCEPTION WHEN OTHERS THEN
97: FROM sys.dba_objects
98: WHERE object_name = 'OKC_CHR_KEYWORD_PVT'
99: AND object_type = 'PACKAGE';
100: fnd_file.put_line(fnd_file.log,'OKC_CHR_KEYWORD_PVT package exists');
101: fnd_file.put_line(fnd_file.log,'OKC_CHR_KEYWORD_PVT package owner is '||apps);
102:
103: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 1, 13);
104: EXCEPTION WHEN OTHERS THEN
105: fnd_file.put_line(fnd_file.log,'ERROR: OKC_CHR__KEYWORD_PVT package doesn''t exist');
101: fnd_file.put_line(fnd_file.log,'OKC_CHR_KEYWORD_PVT package owner is '||apps);
102:
103: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 1, 13);
104: EXCEPTION WHEN OTHERS THEN
105: fnd_file.put_line(fnd_file.log,'ERROR: OKC_CHR__KEYWORD_PVT package doesn''t exist');
106: RAISE anyexp;
107: END;
108:
109: BEGIN
106: RAISE anyexp;
107: END;
108:
109: BEGIN
110: fnd_file.put_line(fnd_file.log,'Checking OKC_K_HEADERS_TL table ...');
111: SELECT owner INTO okc
112: FROM sys.dba_tables
113: WHERE table_name = 'OKC_K_HEADERS_TL';
114: fnd_file.put_line(fnd_file.log,'OKC_K_HEADERS_TL table exists');
110: fnd_file.put_line(fnd_file.log,'Checking OKC_K_HEADERS_TL table ...');
111: SELECT owner INTO okc
112: FROM sys.dba_tables
113: WHERE table_name = 'OKC_K_HEADERS_TL';
114: fnd_file.put_line(fnd_file.log,'OKC_K_HEADERS_TL table exists');
115: fnd_file.put_line(fnd_file.log,'OKC_K_HEADERS_TL table owner is '||okc);
116:
117: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 2, 13);
118:
111: SELECT owner INTO okc
112: FROM sys.dba_tables
113: WHERE table_name = 'OKC_K_HEADERS_TL';
114: fnd_file.put_line(fnd_file.log,'OKC_K_HEADERS_TL table exists');
115: fnd_file.put_line(fnd_file.log,'OKC_K_HEADERS_TL table owner is '||okc);
116:
117: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 2, 13);
118:
119: EXCEPTION WHEN OTHERS THEN
116:
117: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 2, 13);
118:
119: EXCEPTION WHEN OTHERS THEN
120: fnd_file.put_line(fnd_file.log,'ERROR: OKC_K_HEADERS_TL table doesn''t exist');
121: RAISE anyexp;
122: END;
123:
124: BEGIN
122: END;
123:
124: BEGIN
125: EXECUTE IMMEDIATE 'GRANT EXECUTE ON '||apps||'.OKC_CHR_KEYWORD_PVT TO '||okc;
126: fnd_file.put_line(fnd_file.log,'Granted execute on '||apps||'.OKC_CHR_KEYWORD_PVT to '||okc);
127:
128: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 3, 13);
129:
130: EXCEPTION WHEN OTHERS THEN
127:
128: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 3, 13);
129:
130: EXCEPTION WHEN OTHERS THEN
131: fnd_file.put_line(fnd_file.log,'ERROR: Couldn''t grant execute on '||apps||'.OKC_CHR_KEYWORD_PVT to '||okc);
132: RAISE anyexp;
133: END;
134:
135:
141: -- Create datastore okc_k_headers_tl_datastore
142:
143: BEGIN
144: BEGIN
145: fnd_file.put_line(fnd_file.log,'Before drop preference');
146: ad_ctx_ddl.drop_preference('okc_k_headers_tl_datastore');
147: fnd_file.put_line(fnd_file.log,'Preference dropped successfully');
148: EXCEPTION
149: WHEN OTHERS THEN
143: BEGIN
144: BEGIN
145: fnd_file.put_line(fnd_file.log,'Before drop preference');
146: ad_ctx_ddl.drop_preference('okc_k_headers_tl_datastore');
147: fnd_file.put_line(fnd_file.log,'Preference dropped successfully');
148: EXCEPTION
149: WHEN OTHERS THEN
150: NULL;
151: END;
148: EXCEPTION
149: WHEN OTHERS THEN
150: NULL;
151: END;
152: fnd_file.put_line(fnd_file.log,'Before create preference');
153: ad_ctx_ddl.create_preference('okc_k_headers_tl_datastore','multi_column_datastore');
154: ad_ctx_ddl.set_attribute('okc_k_headers_tl_datastore','columns',
155: 'cognomen, short_description, description');
156: fnd_file.put_line(fnd_file.log,'Preference created successfully');
152: fnd_file.put_line(fnd_file.log,'Before create preference');
153: ad_ctx_ddl.create_preference('okc_k_headers_tl_datastore','multi_column_datastore');
154: ad_ctx_ddl.set_attribute('okc_k_headers_tl_datastore','columns',
155: 'cognomen, short_description, description');
156: fnd_file.put_line(fnd_file.log,'Preference created successfully');
157: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 4, 13);
158: END;
159:
160: -- Creating all Lexers and sublexers
159:
160: -- Creating all Lexers and sublexers
161: BEGIN
162: BEGIN
163: fnd_file.put_line(fnd_file.log,'Dropping multi lexer');
164: ad_ctx_ddl.drop_preference('okc_k_headers_tl_lexer');
165: fnd_file.put_line(fnd_file.log,'Multi lexer successfully');
166: EXCEPTION
167: WHEN OTHERS THEN
161: BEGIN
162: BEGIN
163: fnd_file.put_line(fnd_file.log,'Dropping multi lexer');
164: ad_ctx_ddl.drop_preference('okc_k_headers_tl_lexer');
165: fnd_file.put_line(fnd_file.log,'Multi lexer successfully');
166: EXCEPTION
167: WHEN OTHERS THEN
168: NULL;
169: END;
166: EXCEPTION
167: WHEN OTHERS THEN
168: NULL;
169: END;
170: fnd_file.put_line(fnd_file.log,'Creating multi lexer');
171: ad_ctx_ddl.create_preference('okc_k_headers_tl_lexer','multi_lexer');
172: BEGIN
173: fnd_file.put_line(fnd_file.log,'Dropping basic lexer');
174: ad_ctx_ddl.drop_preference('okc_chrtl_blexer');
169: END;
170: fnd_file.put_line(fnd_file.log,'Creating multi lexer');
171: ad_ctx_ddl.create_preference('okc_k_headers_tl_lexer','multi_lexer');
172: BEGIN
173: fnd_file.put_line(fnd_file.log,'Dropping basic lexer');
174: ad_ctx_ddl.drop_preference('okc_chrtl_blexer');
175: fnd_file.put_line(fnd_file.log,'Basic lexer dropped successfully');
176: EXCEPTION
177: WHEN OTHERS THEN
171: ad_ctx_ddl.create_preference('okc_k_headers_tl_lexer','multi_lexer');
172: BEGIN
173: fnd_file.put_line(fnd_file.log,'Dropping basic lexer');
174: ad_ctx_ddl.drop_preference('okc_chrtl_blexer');
175: fnd_file.put_line(fnd_file.log,'Basic lexer dropped successfully');
176: EXCEPTION
177: WHEN OTHERS THEN
178: NULL;
179: END;
176: EXCEPTION
177: WHEN OTHERS THEN
178: NULL;
179: END;
180: fnd_file.put_line(fnd_file.log,'Creating basic lexer with its attributes');
181: ad_ctx_ddl.create_preference('okc_chrtl_blexer','basic_lexer');
182: ad_ctx_ddl.set_attribute('okc_chrtl_blexer','index_themes','false');
183: ad_ctx_ddl.set_attribute('okc_chrtl_blexer','index_text','true');
184: ad_ctx_ddl.set_attribute('okc_chrtl_blexer','base_letter','true');
182: ad_ctx_ddl.set_attribute('okc_chrtl_blexer','index_themes','false');
183: ad_ctx_ddl.set_attribute('okc_chrtl_blexer','index_text','true');
184: ad_ctx_ddl.set_attribute('okc_chrtl_blexer','base_letter','true');
185: ad_ctx_ddl.set_attribute('okc_chrtl_blexer','mixed_case','false');
186: fnd_file.put_line(fnd_file.log,'Basic lexer with its attributes created successfully');
187:
188: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 5, 13);
189:
190: BEGIN
187:
188: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 5, 13);
189:
190: BEGIN
191: fnd_file.put_line(fnd_file.log,'Dropping Chinese lexer');
192: ad_ctx_ddl.drop_preference('okc_chrtl_clexer');
193: fnd_file.put_line(fnd_file.log,'Chinese lexer dropped successfully');
194: EXCEPTION
195: WHEN OTHERS THEN
189:
190: BEGIN
191: fnd_file.put_line(fnd_file.log,'Dropping Chinese lexer');
192: ad_ctx_ddl.drop_preference('okc_chrtl_clexer');
193: fnd_file.put_line(fnd_file.log,'Chinese lexer dropped successfully');
194: EXCEPTION
195: WHEN OTHERS THEN
196: NULL;
197: END;
206: AND obj_name = 'CHINESE_LEXER';
207: EXCEPTION
208: WHEN OTHERS THEN yes_no := 'N';
209: END;
210: fnd_file.put_line(fnd_file.log,'Chinese lexer: yes_no: ' || yes_no);
211: IF yes_no = 'Y' THEN
212: ad_ctx_ddl.create_preference('okc_chrtl_clexer','chinese_lexer');
213: ELSE
214: ad_ctx_ddl.create_preference('okc_chrtl_clexer','chinese_vgram_lexer');
212: ad_ctx_ddl.create_preference('okc_chrtl_clexer','chinese_lexer');
213: ELSE
214: ad_ctx_ddl.create_preference('okc_chrtl_clexer','chinese_vgram_lexer');
215: END IF;
216: fnd_file.put_line(fnd_file.log,'Chinese lexer created successfully');
217: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 6, 13);
218:
219: END;
220:
218:
219: END;
220:
221: BEGIN
222: fnd_file.put_line(fnd_file.log,'Dropping Japanese lexer');
223: ad_ctx_ddl.drop_preference('okc_chrtl_jlexer');
224: fnd_file.put_line(fnd_file.log,'Japanese lexer dropped successfully');
225: EXCEPTION
226: WHEN OTHERS THEN
220:
221: BEGIN
222: fnd_file.put_line(fnd_file.log,'Dropping Japanese lexer');
223: ad_ctx_ddl.drop_preference('okc_chrtl_jlexer');
224: fnd_file.put_line(fnd_file.log,'Japanese lexer dropped successfully');
225: EXCEPTION
226: WHEN OTHERS THEN
227: NULL;
228: END;
238: EXCEPTION
239: WHEN OTHERS THEN
240: yes_no := 'N';
241: END;
242: fnd_file.put_line(fnd_file.log,'Japanese lexer: yes_no: ' || yes_no);
243: IF yes_no = 'Y' THEN
244: ad_ctx_ddl.create_preference('okc_chrtl_jlexer','japanese_lexer');
245: ELSE
246: ad_ctx_ddl.create_preference('okc_chrtl_jlexer','japanese_vgram_lexer');
244: ad_ctx_ddl.create_preference('okc_chrtl_jlexer','japanese_lexer');
245: ELSE
246: ad_ctx_ddl.create_preference('okc_chrtl_jlexer','japanese_vgram_lexer');
247: END IF;
248: fnd_file.put_line(fnd_file.log,'Japanese lexer created successfully');
249: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 7, 13);
250: END;
251:
252: BEGIN
249: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 7, 13);
250: END;
251:
252: BEGIN
253: fnd_file.put_line(fnd_file.log,'Dropping korean lexer');
254: ad_ctx_ddl.drop_preference('okc_chrtl_klexer');
255: fnd_file.put_line(fnd_file.log,'Korean lexer dropped successfully');
256: EXCEPTION
257: WHEN OTHERS THEN
251:
252: BEGIN
253: fnd_file.put_line(fnd_file.log,'Dropping korean lexer');
254: ad_ctx_ddl.drop_preference('okc_chrtl_klexer');
255: fnd_file.put_line(fnd_file.log,'Korean lexer dropped successfully');
256: EXCEPTION
257: WHEN OTHERS THEN
258: NULL;
259: END;
269: EXCEPTION
270: WHEN OTHERS THEN
271: yes_no := 'N';
272: END;
273: fnd_file.put_line(fnd_file.log,'Korean lexer: yes_no: ' || yes_no);
274: IF yes_no = 'Y' THEN
275: ad_ctx_ddl.create_preference('okc_chrtl_klexer', 'korean_morph_lexer');
276: ad_ctx_ddl.set_attribute('okc_chrtl_klexer', 'one_char_word', 'true');
277: ad_ctx_ddl.set_attribute('okc_chrtl_klexer', 'number', 'true');
278: ELSE
279: ad_ctx_ddl.create_preference('okc_chrtl_klexer', 'korean_lexer');
280: END IF;
281:
282: fnd_file.put_line(fnd_file.log,'Korean lexer created successfully');
283: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 8, 13);
284:
285: END;
286:
283: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 8, 13);
284:
285: END;
286:
287: fnd_file.put_line(fnd_file.log,'Before Add Sub Lexer');
288: ad_ctx_ddl.add_sub_lexer('okc_k_headers_tl_lexer','default','okc_chrtl_blexer');
289: ad_ctx_ddl.add_sub_lexer('okc_k_headers_tl_lexer','ja','okc_chrtl_jlexer');
290: ad_ctx_ddl.add_sub_lexer('okc_k_headers_tl_lexer','ko','okc_chrtl_klexer');
291: ad_ctx_ddl.add_sub_lexer('okc_k_headers_tl_lexer','zhs','okc_chrtl_clexer');
290: ad_ctx_ddl.add_sub_lexer('okc_k_headers_tl_lexer','ko','okc_chrtl_klexer');
291: ad_ctx_ddl.add_sub_lexer('okc_k_headers_tl_lexer','zhs','okc_chrtl_clexer');
292: ad_ctx_ddl.add_sub_lexer('okc_k_headers_tl_lexer','zht','okc_chrtl_clexer');
293:
294: fnd_file.put_line(fnd_file.log,'Sub Lexer Added Successfully');
295: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 9, 13);
296:
297: END;
298:
298:
299: --Create wordlist okc_k_headers_tl_wordlist
300: BEGIN
301: BEGIN
302: fnd_file.put_line(fnd_file.log,'Dropping WordList');
303: ad_ctx_ddl.drop_preference('okc_k_headers_tl_wordlist');
304: fnd_file.put_line(fnd_file.log,'WordList dropped successfully');
305: EXCEPTION
306: WHEN OTHERS THEN
300: BEGIN
301: BEGIN
302: fnd_file.put_line(fnd_file.log,'Dropping WordList');
303: ad_ctx_ddl.drop_preference('okc_k_headers_tl_wordlist');
304: fnd_file.put_line(fnd_file.log,'WordList dropped successfully');
305: EXCEPTION
306: WHEN OTHERS THEN
307: NULL;
308: END;
305: EXCEPTION
306: WHEN OTHERS THEN
307: NULL;
308: END;
309: fnd_file.put_line(fnd_file.log,'Creating WordList...');
310: ad_ctx_ddl.create_preference('okc_k_headers_tl_wordlist','basic_wordlist');
311: ad_ctx_ddl.set_attribute('okc_k_headers_tl_wordlist','stemmer','auto');
312: ad_ctx_ddl.set_attribute('okc_k_headers_tl_wordlist','fuzzy_match','auto');
313: fnd_file.put_line(fnd_file.log,'WordList created succesfully');
309: fnd_file.put_line(fnd_file.log,'Creating WordList...');
310: ad_ctx_ddl.create_preference('okc_k_headers_tl_wordlist','basic_wordlist');
311: ad_ctx_ddl.set_attribute('okc_k_headers_tl_wordlist','stemmer','auto');
312: ad_ctx_ddl.set_attribute('okc_k_headers_tl_wordlist','fuzzy_match','auto');
313: fnd_file.put_line(fnd_file.log,'WordList created succesfully');
314: END;
315:
316: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 10, 13);
317:
316: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 10, 13);
317:
318: -- Drop context index okc_k_headers_tl_ctx (if exists)
319: BEGIN
320: fnd_file.put_line(fnd_file.log,'Dropping INDEX okc_k_headers_tl_ctx...');
321: EXECUTE IMMEDIATE 'DROP INDEX ' || okc ||'.okc_k_headers_tl_ctx FORCE';
322: fnd_file.put_line(fnd_file.log,'INDEX okc_k_headers_tl_ctx succesfully dropped');
323: EXCEPTION
324: WHEN OTHERS THEN
318: -- Drop context index okc_k_headers_tl_ctx (if exists)
319: BEGIN
320: fnd_file.put_line(fnd_file.log,'Dropping INDEX okc_k_headers_tl_ctx...');
321: EXECUTE IMMEDIATE 'DROP INDEX ' || okc ||'.okc_k_headers_tl_ctx FORCE';
322: fnd_file.put_line(fnd_file.log,'INDEX okc_k_headers_tl_ctx succesfully dropped');
323: EXCEPTION
324: WHEN OTHERS THEN
325: NULL;
326: END;
331: DECLARE
332: l_max_memory NUMBER;
333: l_cpu_count NUMBER;
334: BEGIN
335: fnd_file.put_line(fnd_file.log,'Index Creation Logic Begins');
336:
337: BEGIN
338: SELECT par_value INTO l_max_memory
339: FROM ctx_parameters
341: EXCEPTION WHEN OTHERS THEN
342: NULL;
343: END;
344:
345: fnd_file.put_line(fnd_file.log,'Max Memory: '||l_max_memory);
346:
347: BEGIN
348: SELECT value INTO l_cpu_count
349: FROM v$parameter
351: EXCEPTION WHEN OTHERS THEN
352: NULL;
353: END;
354:
355: fnd_file.put_line(fnd_file.log,'CPU Count: '||l_cpu_count);
356: fnd_file.put_line(fnd_file.log,'Before Index Creation');
357:
358: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 12, 13);
359:
352: NULL;
353: END;
354:
355: fnd_file.put_line(fnd_file.log,'CPU Count: '||l_cpu_count);
356: fnd_file.put_line(fnd_file.log,'Before Index Creation');
357:
358: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 12, 13);
359:
360: -- Changes for Bug# 6921424
375: MEMORY ' || l_max_memory || -- For Bug# 6921424
376: ' STOPLIST ctxsys.default_stoplist
377: WORDLIST ' || apps || '.okc_k_headers_tl_wordlist'') PARALLEL ' || l_cpu_count; -- For Bug# 6921424
378:
379: fnd_file.put_line(fnd_file.log,'Index OKC_K_HEADERS_TL_CTX created successfully');
380: dbms_application_info.set_session_longops( rindex, slno, null, request_id, request_id, 13, 13);
381:
382: EXCEPTION
383: WHEN ANYEXP THEN