1 PACKAGE ctx_doc AUTHID current_user AS
2
3 -- constants
4
5 -- SAVE_COPY Constants
6 SAVE_COPY_FALLBACK constant number := 0; /* Fallback to datastore if document
7 doesn't exist in $D*/
8 SAVE_COPY_ERROR constant number := 1; /* Only use $D table for document
9 fetching */
10 SAVE_COPY_IGNORE constant number := 2; /* Ignore $D table and always fetch
11 from datastore */
12
13 TYPE_ROWID constant varchar2(20) := 'ROWID';
14 TYPE_PRIMARY_KEY constant varchar2(20) := 'PRIMARY_KEY';
15 UNLIMITED_THEMES constant number := NULL;
16 /* Beehive: delimiter used in stemming */
17 STEM_DELIMITER constant varchar2(2) := '!?';
18
19 -- package variables
20
21 pv_ctx_doc_key_type varchar2(500) := null;
22
23 -- type declaration
24
25 type theme_rec is record (
26 theme varchar2(2000),
27 weight number
28 );
29 type theme_tab is table of theme_rec index by binary_integer;
30
31 type token_rec is record (
32 token varchar2(64),
33 offset number,
34 length number
35 );
36 type token_tab is table of token_rec index by binary_integer;
37
38 type highlight_rec is record (
39 offset number,
40 length number
41 );
42 type highlight_tab is table of highlight_rec index by binary_integer;
43
44 /* Beehive: Add record/table needed to return stems */
45 type stem_rec is record (
46 stem varchar2(1000),
47 is_in_lexicon boolean
48 );
49 type stem_tab is table of stem_rec index by binary_integer;
50
51 type stem_group_rec is record (
52 /* We made the size of word to be larger than the size used for tokens
53 * as this might be a multi-word token
54 */
55 word varchar2(1000),
56 stems stem_tab,
57 offset number,
58 length number
59 );
60 type stem_group_tab is table of stem_group_rec index by binary_integer;
61
62 /* Beehive: Add record/table needed to return noun phrases */
63 type noun_phrase_rec is record (
64 term varchar2(64),
65 pos_tag varchar2(64), /* TBD: Confirm with Inxight and reduce size */
66 offset number,
67 length number,
68 is_phrase_start boolean,
69 is_in_lexicon boolean
70 );
71 type noun_phrase_tab is table of noun_phrase_rec index by binary_integer;
72
73 /* Beehive: Add record/table needed to return languages */
74 type language_rec is record (
75 language varchar2(64),
76 score number
77 );
78 type language_tab is table of language_rec index by binary_integer;
79
80 /* Beehive: Add record/table needed to return parts of speech */
81 type pos_tag_tab is table of varchar2(64) index by binary_integer;
82
83 type part_of_speech_rec is record (
84 word varchar2(64),
85 pos_tags pos_tag_tab,
86 offset number,
87 length number,
88 is_in_lexicon boolean
89 );
90 type part_of_speech_tab is table of part_of_speech_rec index by binary_integer;
91
92 /*---------------------------- set_key_type -----------------------------*/
93 /*
94 NAME
95 set_key_type - toggles CTX_DOC_KEY_TYPE
96
97 DESCRIPTION
98 toggles system parameter CTX_DOC_KEY_TYPE between ROWID and
99 PRIMARY_KEY
100
101 ARGUMENT
102 key_type - value of CTX_DOC_KEY_TYPE
103 */
104 PROCEDURE set_key_type(
105 key_type in varchar2
106 );
107 PRAGMA SUPPLEMENTAL_LOG_DATA(set_key_type, AUTO);
108
109 /*---------------------------- get_key_type -----------------------------*/
110 /*
111 NAME
112 get_key_type - returns CTX_DOC_KEY_TYPE
113
114 */
115 FUNCTION get_key_type return varchar2;
116
117 /*------------------------------- themes --------------------------------*/
118 /*
119 NAME
120 themes - request the themes for a document
121
122 DESCRIPTION
123 This procedure will generate the themes for a given document.
124 The themes will be written to the theme table specified.
125 The theme table must have the following columns:
126
127 query_id number (the query_id)
128 theme varchar2(2000) (the theme)
129 weight number (the theme weight)
130
131 ARGUMENTS
132 index_name - the name of the text index
133 textkey - the primary key of the document
134 restab - the name of the theme table
135 query_id - a query id
136 full_themes - should the full themes be displayed?
137 num_themes - maximum number of themes to return
138 use_saved_copy - Can be set to any of these values:
139 SAVE_COPY_FALLBACK / SAVE_COPY_ERROR /
140 SAVE_COPY_IGNORE
141 */
142 PROCEDURE themes (
143 index_name in varchar2,
144 textkey in varchar2,
145 restab in varchar2,
146 query_id in number default 0,
147 full_themes in boolean default false,
148 num_themes in number default 50,
149 use_saved_copy in number default ctx_doc.save_copy_fallback
150 );
151
152 /*------------------------------- themes --------------------------------*/
153 /*
154 NAME
155 themes - request the themes for a document
156
157 DESCRIPTION
158 This version of themes returns the results into a PL/SQL table
159 instead of a result table
160
161 NOTES
162 Existing contents of restab will be destroyed
163 */
164 PROCEDURE themes (
165 index_name in varchar2,
166 textkey in varchar2,
167 restab in out nocopy theme_tab,
168 full_themes in boolean default false,
169 num_themes in number default 50,
170 use_saved_copy in number default ctx_doc.save_copy_fallback
171 );
172
173 /*------------------------------ policy_themes ------------------------------*/
174 /*
175 NAME
176 policy_themes - request the themes for a document on demand
177
178 DESCRIPTION
179 This version of themes accepts a policy name and a single VARCHAR2
180 document. Returns the results into a PL/SQL table.
181
182 NOTES
183 Existing contents of restab will be destroyed
184 */
185 PROCEDURE policy_themes (
186 policy_name in varchar2,
187 document in varchar2,
188 restab in out nocopy theme_tab,
189 full_themes in boolean default false,
190 num_themes in number default 50,
191 language in varchar2 default NULL,
192 format in varchar2 default NULL,
193 charset in varchar2 default NULL
194 );
195
196 /*------------------------------ policy_themes ------------------------------*/
197 /*
198 NAME
199 policy_themes - request the themes for a document on demand
200
201 DESCRIPTION
202 This version of themes accepts a policy name and a single CLOB
203 document. Returns the results into a PL/SQL table.
204
205 NOTES
206 Existing contents of restab will be destroyed
207 */
208 PROCEDURE policy_themes (
209 policy_name in varchar2,
210 document in clob,
211 restab in out nocopy theme_tab,
212 full_themes in boolean default false,
213 num_themes in number default 50,
214 language in varchar2 default NULL,
215 format in varchar2 default NULL,
216 charset in varchar2 default NULL
217 );
218
219 /*------------------------------ policy_themes ------------------------------*/
220 /*
221 NAME
222 policy_themes - request the themes for a document on demand
223
224 DESCRIPTION
225 This version of themes accepts a policy name and a single BLOB
226 document. Returns the results into a PL/SQL table.
227
228 NOTES
229 Existing contents of restab will be destroyed
230 */
231 PROCEDURE policy_themes (
232 policy_name in varchar2,
233 document in blob,
234 restab in out nocopy theme_tab,
235 full_themes in boolean default false,
236 num_themes in number default 50,
237 language in varchar2 default NULL,
238 format in varchar2 default NULL,
239 charset in varchar2 default NULL
240 );
241
242 /*------------------------------ policy_themes ------------------------------*/
243 /*
244 NAME
245 policy_themes - request the themes for a document on demand
246
247 DESCRIPTION
248 This version of themes accepts a policy name and a single BFILE
249 document. Returns the results into a PL/SQL table.
250
251 NOTES
252 Existing contents of restab will be destroyed
253 */
254 PROCEDURE policy_themes (
255 policy_name in varchar2,
256 document in bfile,
257 restab in out nocopy theme_tab,
258 full_themes in boolean default false,
259 num_themes in number default 50,
260 language in varchar2 default NULL,
261 format in varchar2 default NULL,
262 charset in varchar2 default NULL
263 );
264
265 /*------------------------------- tokens --------------------------------*/
266 /*
267 NAME
268 tokens - request the text tokens for a document
269
270 DESCRIPTION
271 This procedure will generate the tokens for a given document.
272 The tokens will be written to the token table specified.
273 The token table must have the following columns:
274
275 query_id number (the query_id)
276 token varchar2(64) (the token)
277 offset number (the token's character offset)
278 length number (the token's length)
279
280 ARGUMENTS
281 index_name - the name of the text index
282 textkey - the primary key of the document
283 restab - the name of the theme table
284 query_id - a query id
285 use_saved_copy - Can be set to any of these values:
286 SAVE_COPY_FALLBACK / SAVE_COPY_ERROR /
287 SAVE_COPY_IGNORE
288 */
289 PROCEDURE tokens (
290 index_name in varchar2,
291 textkey in varchar2,
292 restab in varchar2,
293 query_id in number default 0,
294 use_saved_copy in number default ctx_doc.save_copy_fallback
295 );
296
297 /*------------------------------- tokens --------------------------------*/
298 /*
299 NAME
300 tokens - request the text tokens for a document
301
302 DESCRIPTION
303 This version of tokens returns the results into a PL/SQL table
304 instead of a result table
305
306 NOTES
307 Existing contents of restab will be destroyed
308 */
309 PROCEDURE tokens (
310 index_name in varchar2,
311 textkey in varchar2,
312 restab in out nocopy token_tab,
313 use_saved_copy in number default ctx_doc.save_copy_fallback
314 );
315
316 /*------------------------------ policy_tokens ------------------------------*/
317 /*
318 NAME
319 policy_tokens - request the text tokens for a document on demand
320
321 DESCRIPTION
322 This version of tokens accepts a policy name and a single VARCHAR2
323 document. Returns the results into a PL/SQL table.
324
325 NOTES
326 Existing contents of restab will be destroyed
327 */
328 PROCEDURE policy_tokens (
329 policy_name in varchar2,
330 document in varchar2,
331 restab in out nocopy token_tab,
332 language in varchar2 default NULL,
333 format in varchar2 default NULL,
334 charset in varchar2 default NULL
335 );
336
337 /*------------------------------ policy_tokens -------------------------------*/
338 /*
339 NAME
340 policy_tokens - request the text tokens for a document on demand
341
342 DESCRIPTION
343 This version of tokens accepts a policy name and a single CLOB
344 document. Returns the results into a PL/SQL table
345
346 NOTES
347 Existing contents of restab will be destroyed
348 */
349 PROCEDURE policy_tokens (
350 policy_name in varchar2,
351 document in clob,
352 restab in out nocopy token_tab,
353 language in varchar2 default NULL,
354 format in varchar2 default NULL,
355 charset in varchar2 default NULL
356 );
357
358 /*------------------------------ policy_tokens ------------------------------*/
359 /*
360 NAME
361 policy_tokens - request the text tokens for a document on demand
362
363 DESCRIPTION
364 This version of tokens accepts a policy name and a single BLOB
365 document. Returns the results into a PL/SQL table
366
367 NOTES
368 Existing contents of restab will be destroyed
369 */
370 PROCEDURE policy_tokens (
371 policy_name in varchar2,
372 document in blob,
373 restab in out nocopy token_tab,
374 language in varchar2 default NULL,
375 format in varchar2 default NULL,
376 charset in varchar2 default NULL
377 );
378
379 /*------------------------------ policy_tokens -----------------------------*/
380 /*
381 NAME
382 policy_tokens - request the text tokens for a document on demand
383
384 DESCRIPTION
385 This version of tokens accepts a policy name and a single BFILE
386 document. Returns the results into a PL/SQL table
387
388 NOTES
389 Existing contents of restab will be destroyed
390 */
391 PROCEDURE policy_tokens (
392 policy_name in varchar2,
393 document in bfile,
394 restab in out nocopy token_tab,
395 language in varchar2 default NULL,
396 format in varchar2 default NULL,
397 charset in varchar2 default NULL
398 );
399
400 /* Beehive */
401 /*----------------------- policy_stems (inmem) ----------------------------*/
402 /*
403 NAME
404 policy_stems - request the text stems for a document on demand
405
406 DESCRIPTION
407 This version of stems accepts a policy name and a single varchar2
408 document. Returns the results into a PL/SQL table.
409 The returned values in the PL/SQL table will have 1 cell for each
410 word (can be a multi-word as determined by the Lexer) in the input
411 string document. For each word, all the stems are returned. For each
412 stem, the offset and length (in the input string) of the word for
413 which this is a stem is returned. Additioanlly, for each stem, a boolean
414 value is returned that indicates if the stem was found in the lexicon.
415
416 NOTES
417 Existing contents of restab will be destroyed
418 */
419 PROCEDURE policy_stems (
420 policy_name in varchar2,
421 document in varchar2,
422 restab in out nocopy stem_group_tab,
423 language in varchar2 default NULL,
424 format in varchar2 default NULL,
425 charset in varchar2 default NULL
426 );
427
428 PROCEDURE policy_stems (
429 policy_name in varchar2,
430 document in clob,
431 restab in out nocopy stem_group_tab,
432 language in varchar2 default NULL,
433 format in varchar2 default NULL,
434 charset in varchar2 default NULL
435 );
436
440 policy_noun_phrases - request the noun phrases for a document
437 /*----------------------- policy_noun_phrases (inmem) --------------------*/
438 /*
439 NAME
441
442 DESCRIPTION
443 This version of stems accepts a policy name and a single varchar2
444 document. Returns the results into a PL/SQL table.
445 The returned values in the PL/SQL table will have 1 cell for each
446 noun phrase extracted from the input document. For each noun phrase,
447 the part of speech tags are also returned.
448
449 NOTES
450 Existing contents of restab will be destroyed
451 */
452 PROCEDURE policy_noun_phrases (
453 policy_name in varchar2,
454 document in varchar2,
455 restab in out nocopy noun_phrase_tab,
456 language in varchar2 default NULL,
457 format in varchar2 default NULL,
458 charset in varchar2 default NULL
459 );
460
461 PROCEDURE policy_noun_phrases (
462 policy_name in varchar2,
463 document in clob,
464 restab in out nocopy noun_phrase_tab,
465 language in varchar2 default NULL,
466 format in varchar2 default NULL,
467 charset in varchar2 default NULL
468 );
469
470 /*----------------------- policy_languages (inmem) ----------------------------*/
471 /*
472 NAME
473 policy_languages - request the languages for a document
474
475 DESCRIPTION
476 This version of languages accepts a policy name and a single varchar2
477 document. Returns the results into a PL/SQL table.
478 The returned values in the PL/SQL table will have 1 cell for each
479 detected language. It will also have a score which indicates the
480 stength of the detected language in this document - the score ranges
481 from 0 to 100 with the highest score referring to the most likely
482 language for the document.
483
484
485 NOTES
486 Existing contents of restab will be destroyed
487 */
488 PROCEDURE policy_languages (
489 policy_name in varchar2,
490 document in varchar2,
491 restab in out nocopy language_tab,
492 format in varchar2 default NULL,
493 charset in varchar2 default NULL
494 );
495
496 PROCEDURE policy_languages (
497 policy_name in varchar2,
498 document in clob,
499 restab in out nocopy language_tab,
500 format in varchar2 default NULL,
501 charset in varchar2 default NULL
502 );
503
504 /*----------------------- policy_part_of_speech (inmem) --------------------------*/
505 /*
506 NAME
507 policy_part_of_speech - request the part_of_speech tags for a document
508
509 DESCRIPTION
510 This version of part_of_speech accepts a policy name and a single varchar2
511 document. Returns the results into a PL/SQL table.
512 The returned values in the PL/SQL table will have 1 cell for each
513 word in the input string document. For each word, the part_of_speech tags
514 are returned.
515
516 If the input parameter disambiguate_tags is set to true, only
517 1 part_of_speech will be returned for each word - this tag is determined
518 by the Lexer by automatically performing disambiguation to identify the most
519 likely tag, given the surrounding context, for a token with more than one
520 possible tag.
521 If the input parameter disambiguate_tags is set to false, all possible tags
522 will be returned for each word.
523
524 Additionally, for each word, the offset and length (in the input string) of
525 the word for and a boolean value indicating if the word was found in the
526 lexicon are also returned.
527
528
529 NOTES
530 Existing contents of restab will be destroyed
531 */
532 PROCEDURE policy_part_of_speech (
533 policy_name in varchar2,
534 document in varchar2,
535 restab in out nocopy part_of_speech_tab,
536 language in varchar2 default NULL,
537 format in varchar2 default NULL,
538 charset in varchar2 default NULL,
539 disambiguate_tags in boolean default true
540 );
541
542 PROCEDURE policy_part_of_speech (
543 policy_name in varchar2,
544 document in clob,
545 restab in out nocopy part_of_speech_tab,
546 language in varchar2 default NULL,
547 format in varchar2 default NULL,
548 charset in varchar2 default NULL,
549 disambiguate_tags in boolean default true
550 );
551
552 /*------------------------------- gist ----------------------------------*/
553 /*
554 NAME
555 gist - request the gist for a document
556
557 DESCRIPTION
558
559 This procedure will generate gist(s) of a given document.
560 The gist(s) will be written to the gist table specified.
561 The gist table must have the following columns:
562
563 query_id number (the query id)
564 pov varchar2(80) (gist point-of-view)
565 gist clob (gist)
566
567 ARGUMENTS
568 index_name - the name of the text index
569 textkey - the primary key of the document
573 pov - point-of-view limit
570 restab - the name of the gist table
571 query_id - the query id
572 glevel - P or S
574 numparagraphs - total number of paragraphs in gist(>=0)
575 maxpercent - maximum percent of document in gist(>=0,<=100)
576 num_themes - maximum number of themes to return
577 use_saved_copy - Can be set to any of these values:
578 SAVE_COPY_FALLBACK / SAVE_COPY_ERROR /
579 SAVE_COPY_IGNORE
580 */
581 PROCEDURE gist (
582 index_name in varchar2,
583 textkey in varchar2,
584 restab in varchar2,
585 query_id in number default 0,
586 glevel in varchar2 default 'P',
587 pov in varchar2 default null,
588 numParagraphs in number default null,
589 maxPercent in number default null,
590 num_themes in number default 50,
591 use_saved_copy in number default ctx_doc.save_copy_fallback
592 );
593
594 /*------------------------------- gist ----------------------------------*/
595 /*
596 NAME
597 gist - request the gist for a document
598
599 DESCRIPTION
600 This version of gist returns the result into a CLOB locator
601 instead of a result table.
602
603 NOTES
604 Unlike result table gist, this version of gist returns only one
605 gist. If pov is not supplied, the GENERIC gist is returned.
606
607 If result is NULL on entry, a temporary lob is allocated and returned.
608 it is up to the calling procedure to deallocate this lob.
609
610 Any existing contents of the lob locator passed in are cleared.
611 */
612 PROCEDURE gist (
613 index_name in varchar2,
614 textkey in varchar2,
615 restab in out nocopy clob,
616 glevel in varchar2 default 'P',
617 pov in varchar2 default 'GENERIC',
618 numParagraphs in number default null,
619 maxPercent in number default null,
620 num_themes in number default 50,
621 use_saved_copy in number default ctx_doc.save_copy_fallback
622 );
623
624 /*------------------------------ policy_gist --------------------------------*/
625 /*
626 NAME
627 policy_gist - request the gist for a document on demand
628
629 DESCRIPTION
630 This version of tokens accepts a policy name and a single VARCHAR2
631 document. Returns the result into a CLOB locator.
632
633 NOTES
634 Unlike result table gist, this version of gist returns only one
635 gist. If pov is not supplied, the GENERIC gist is returned.
636
637 If result is NULL on entry, a temporary lob is allocated and returned.
638 it is up to the calling procedure to deallocate this lob.
639
640 Any existing contents of the lob locator passed in are cleared.
641 */
642 PROCEDURE policy_gist (
643 policy_name in varchar2,
644 document in varchar2,
645 restab in out nocopy clob,
646 glevel in varchar2 default 'P',
647 pov in varchar2 default 'GENERIC',
648 numParagraphs in number default null,
649 maxPercent in number default null,
650 num_themes in number default 50,
651 language in varchar2 default NULL,
652 format in varchar2 default NULL,
653 charset in varchar2 default NULL
654 );
655
656 /*------------------------------ policy_gist --------------------------------*/
657 /*
658 NAME
659 policy_gist - request the gist for a document on demand
660
661 DESCRIPTION
662 This version of tokens accepts a policy name and a single CLOB
663 document. Returns the result into a CLOB locator.
664
665 NOTES
666 Unlike result table gist, this version of gist returns only one
667 gist. If pov is not supplied, the GENERIC gist is returned.
668
669 If result is NULL on entry, a temporary lob is allocated and returned.
670 it is up to the calling procedure to deallocate this lob.
671
672 Any existing contents of the lob locator passed in are cleared.
673 */
674 PROCEDURE policy_gist (
675 policy_name in varchar2,
676 document in clob,
677 restab in out nocopy clob,
678 glevel in varchar2 default 'P',
679 pov in varchar2 default 'GENERIC',
680 numParagraphs in number default null,
681 maxPercent in number default null,
682 num_themes in number default 50,
683 language in varchar2 default NULL,
684 format in varchar2 default NULL,
685 charset in varchar2 default NULL
686 );
687
688 /*------------------------------ policy_gist --------------------------------*/
689 /*
690 NAME
691 policy_gist - request the gist for a document on demand
692
693 DESCRIPTION
694 This version of tokens accepts a policy name and a single BLOB
695 document. Returns the result into a CLOB locator.
696
697 NOTES
698 Unlike result table gist, this version of gist returns only one
699 gist. If pov is not supplied, the GENERIC gist is returned.
700
704 Any existing contents of the lob locator passed in are cleared.
701 If result is NULL on entry, a temporary lob is allocated and returned.
702 it is up to the calling procedure to deallocate this lob.
703
705 */
706 PROCEDURE policy_gist (
707 policy_name in varchar2,
708 document in blob,
709 restab in out nocopy clob,
710 glevel in varchar2 default 'P',
711 pov in varchar2 default 'GENERIC',
712 numParagraphs in number default null,
713 maxPercent in number default null,
714 num_themes in number default 50,
715 language in varchar2 default NULL,
716 format in varchar2 default NULL,
717 charset in varchar2 default NULL
718 );
719
720 /*------------------------------ policy_gist --------------------------------*/
721 /*
722 NAME
723 policy_gist - request the gist for a document on demand
724
725 DESCRIPTION
726 This version of tokens accepts a policy name and a single BFILE
727 document. Returns the result into a CLOB locator.
728
729 NOTES
730 Unlike result table gist, this version of gist returns only one
731 gist. If pov is not supplied, the GENERIC gist is returned.
732
733 If result is NULL on entry, a temporary lob is allocated and returned.
734 it is up to the calling procedure to deallocate this lob.
735
736 Any existing contents of the lob locator passed in are cleared.
737 */
738 PROCEDURE policy_gist (
739 policy_name in varchar2,
740 document in bfile,
741 restab in out nocopy clob,
742 glevel in varchar2 default 'P',
743 pov in varchar2 default 'GENERIC',
744 numParagraphs in number default null,
745 maxPercent in number default null,
746 num_themes in number default 50,
747 language in varchar2 default NULL,
748 format in varchar2 default NULL,
749 charset in varchar2 default NULL
750 );
751
752 /*------------------------------- filter -------------------------------*/
753 /*
754 NAME
755 filter - return filtered text
756
757 DESCRIPTION
758 Filter takes a document reference and returns a plaintext version
759 The filter result table should have the following columns:
760
761 query_id number (the query id)
762 document clob (plaintext document)
763
764 ARGUMENTS
765 index_name -- name of the index
766 textkey -- the document for which to produce highlights
767 restab -- the filter result table
768 query_id -- the query id
769 plaintext -- set to TRUE if plaintext is desired
770 use_saved_copy -- Can be set to any of these values:
771 SAVE_COPY_FALLBACK / SAVE_COPY_ERROR / SAVE_COPY_IGNORE
772 */
773 PROCEDURE filter (
774 index_name in varchar2,
775 textkey in varchar2,
776 restab in varchar2,
777 query_id in number default 0,
778 plaintext in boolean default FALSE,
779 use_saved_copy in number default ctx_doc.save_copy_fallback
780 );
781
782 /*------------------------------- filter -------------------------------*/
783 /*
784 NAME
785 filter - return filtered text
786
787 DESCRIPTION
788 This version of filter returns the result into a CLOB locator
789 instead of a result table.
790
791 NOTES
792 If result is NULL on entry, a temporary lob is allocated and returned.
793 it is up to the calling procedure to deallocate this lob.
794
795 Any existing contents of the lob locator passed in are cleared.
796 */
797 PROCEDURE filter (
798 index_name in varchar2,
799 textkey in varchar2,
800 restab in out nocopy clob,
801 plaintext in boolean default FALSE,
802 use_saved_copy in number default ctx_doc.save_copy_fallback
803 );
804
805 /*----------------------------- policy_filter ------------------------------*/
806 /*
807 NAME
808 policy_filter - return filtered text on demand
809
810 DESCRIPTION
811 This version of filter accepts a policy name and a single VARCHAR2
812 document. Returns the result into a CLOB locator.
813
814 NOTES
815 If result is NULL on entry, a temporary lob is allocated and returned.
816 it is up to the calling procedure to deallocate this lob.
817
818 Any existing contents of the lob locator passed in are cleared.
819 */
820 PROCEDURE policy_filter (
821 policy_name in varchar2,
822 document in clob,
823 restab in out nocopy clob,
824 plaintext in boolean default FALSE,
825 language in varchar2 default NULL,
826 format in varchar2 default NULL,
827 charset in varchar2 default NULL
828 );
829
830 /*----------------------------- policy_filter ------------------------------*/
831 /*
832 NAME
833 policy_filter - return filtered text on demand
834
835 DESCRIPTION
836 This version of filter accepts a policy name and a single CLOB
837 document. Returns the result into a CLOB locator.
838
839 NOTES
843 Any existing contents of the lob locator passed in are cleared.
840 If result is NULL on entry, a temporary lob is allocated and returned.
841 it is up to the calling procedure to deallocate this lob.
842
844 */
845 PROCEDURE policy_filter (
846 policy_name in varchar2,
847 document in blob,
848 restab in out nocopy clob,
849 plaintext in boolean default FALSE,
850 language in varchar2 default NULL,
851 format in varchar2 default NULL,
852 charset in varchar2 default NULL
853 );
854
855 /*----------------------------- policy_filter ------------------------------*/
856 /*
857 NAME
858 policy_filter - return filtered text on demand
859
860 DESCRIPTION
861 This version of filter accepts a policy name and a single BLOB
862 document. Returns the result into a CLOB locator.
863
864 NOTES
865 If result is NULL on entry, a temporary lob is allocated and returned.
866 it is up to the calling procedure to deallocate this lob.
867
868 Any existing contents of the lob locator passed in are cleared.
869 */
870 PROCEDURE policy_filter (
871 policy_name in varchar2,
872 document in bfile,
873 restab in out nocopy clob,
874 plaintext in boolean default FALSE,
875 language in varchar2 default NULL,
876 format in varchar2 default NULL,
877 charset in varchar2 default NULL
878 );
879
880 /*----------------------------- policy_filter ------------------------------*/
881 /*
882 NAME
883 policy_filter - return filtered text on demand
884
885 DESCRIPTION
886 This version of filter accepts a policy name and a single BFILE
887 document. Returns the result into a CLOB locator.
888
889 NOTES
890 If result is NULL on entry, a temporary lob is allocated and returned.
891 it is up to the calling procedure to deallocate this lob.
892
893 Any existing contents of the lob locator passed in are cleared.
894 */
895 PROCEDURE policy_filter (
896 policy_name in varchar2,
897 document in varchar2,
898 restab in out nocopy clob,
899 plaintext in boolean default FALSE,
900 language in varchar2 default NULL,
901 format in varchar2 default NULL,
902 charset in varchar2 default NULL
903 );
904
905 /*------------------------------- highlight ----------------------------*/
906 /*
907 NAME
908 highlight - return highlight information
909
910 DESCRIPTION
911 Highlight takes a query and a document, and returns highlight information
912 The result table should have the following columns:
913
914 query_id number (the query id)
915 offset number (character offset to highlight start)
916 length number (character length of highlight)
917
918 ARGUMENTS
919 index_name -- name of the index
920 textkey -- the document for which to produce highlights
921 text_query -- the query
922 restab -- the highlight result table
923 query_id -- a query id
924 plaintext -- set to TRUE if plaintext offsets are desired
925 use_saved_copy -- Can be set to any of these values:
926 SAVE_COPY_FALLBACK / SAVE_COPY_ERROR / SAVE_COPY_IGNORE
927 */
928 PROCEDURE highlight (
929 index_name in varchar2,
930 textkey in varchar2,
931 text_query in varchar2,
932 restab in varchar2,
933 query_id in number default 0,
934 plaintext in boolean default FALSE,
935 use_saved_copy in number default ctx_doc.save_copy_fallback
936 );
937
938 PROCEDURE highlight_clob_query (
939 index_name in varchar2,
940 textkey in varchar2,
941 text_query in clob,
942 restab in varchar2,
943 query_id in number default 0,
944 plaintext in boolean default FALSE,
945 use_saved_copy in number default ctx_doc.save_copy_fallback
946 );
947
948 /*------------------------------- highlight ----------------------------*/
949 /*
950 NAME
951 highlight - return highlight information
952
953 DESCRIPTION
954 This version of filter returns the results into a PL/SQL table
955 instead of a result table.
956
957 NOTES
958 Existing contents of the table are destroyed
959 */
960 PROCEDURE highlight (
961 index_name in varchar2,
962 textkey in varchar2,
963 text_query in varchar2,
964 restab in out nocopy highlight_tab,
965 plaintext in boolean default FALSE,
966 use_saved_copy in number default ctx_doc.save_copy_fallback
967 );
968
969 PROCEDURE highlight_clob_query (
970 index_name in varchar2,
971 textkey in varchar2,
972 text_query in clob,
973 restab in out nocopy highlight_tab,
974 plaintext in boolean default FALSE,
975 use_saved_copy in number default ctx_doc.save_copy_fallback
976 );
977
978 /*------------------------------ policy_highlight --------------------------*/
979 /*
980 NAME
981 policy_highlight - return highlight information
985 document. Returns the restuls into a PL/SQL table.
982
983 DESCRIPTION
984 This version of highlight accepts a policy name and a single VARCHAR2
986
987 NOTES
988 Existing contents of the table are destroyed
989
990 */
991 PROCEDURE policy_highlight (
992 policy_name in varchar2,
993 document in varchar2,
994 text_query in varchar2,
995 restab in out nocopy highlight_tab,
996 plaintext in boolean default FALSE,
997 language in varchar2 default NULL,
998 format in varchar2 default NULL,
999 charset in varchar2 default NULL
1000 );
1001
1002 PROCEDURE policy_highlight_clob_query (
1003 policy_name in varchar2,
1004 document in varchar2,
1005 text_query in clob,
1006 restab in out nocopy highlight_tab,
1007 plaintext in boolean default FALSE,
1008 language in varchar2 default NULL,
1009 format in varchar2 default NULL,
1010 charset in varchar2 default NULL
1011 );
1012
1013 /*------------------------------ policy_highlight --------------------------*/
1014 /*
1015 NAME
1016 policy_highlight - return highlight information
1017
1018 DESCRIPTION
1019 This version of highlight accepts a policy name and a single CLOB
1020 document. Returns the results into a PL/SQL table.
1021
1022 NOTES
1023 Existing contents of the table are destroyed
1024 */
1025 PROCEDURE policy_highlight (
1026 policy_name in varchar2,
1027 document in clob,
1028 text_query in varchar2,
1029 restab in out nocopy highlight_tab,
1030 plaintext in boolean default FALSE,
1031 language in varchar2 default NULL,
1032 format in varchar2 default NULL,
1033 charset in varchar2 default NULL
1034 );
1035
1036 PROCEDURE policy_highlight_clob_query (
1037 policy_name in varchar2,
1038 document in clob,
1039 text_query in clob,
1040 restab in out nocopy highlight_tab,
1041 plaintext in boolean default FALSE,
1042 language in varchar2 default NULL,
1043 format in varchar2 default NULL,
1044 charset in varchar2 default NULL
1045 );
1046
1047 /*------------------------------ policy_highlight --------------------------*/
1048 /*
1049 NAME
1050 policy_highlight - return highlight information
1051
1052 DESCRIPTION
1053 This version of highlight accepts a policy name and a single BLOB
1054 document. Returns the restuls into a PL/SQL table.
1055
1056 NOTES
1057 Existing contents of the table are destroyed
1058 */
1059 PROCEDURE policy_highlight (
1060 policy_name in varchar2,
1061 document in blob,
1062 text_query in varchar2,
1063 restab in out nocopy highlight_tab,
1064 plaintext in boolean default FALSE,
1065 language in varchar2 default NULL,
1066 format in varchar2 default NULL,
1067 charset in varchar2 default NULL
1068 );
1069
1070 PROCEDURE policy_highlight_clob_query (
1071 policy_name in varchar2,
1072 document in blob,
1073 text_query in clob,
1074 restab in out nocopy highlight_tab,
1075 plaintext in boolean default FALSE,
1076 language in varchar2 default NULL,
1077 format in varchar2 default NULL,
1078 charset in varchar2 default NULL
1079 );
1080
1081 /*------------------------------ policy_highlight --------------------------*/
1082 /*
1083 NAME
1084 policy_highlight- return highlight information
1085
1086 DESCRIPTION
1087 This version of highlight accepts a policy name and a single BFILE
1088 document. Returns the restuls into a PL/SQL table.
1089
1090 NOTES
1091 Existing contents of the table are destroyed
1092 */
1093 PROCEDURE policy_highlight (
1094 policy_name in varchar2,
1095 document in bfile,
1096 text_query in varchar2,
1097 restab in out nocopy highlight_tab,
1098 plaintext in boolean default FALSE,
1099 language in varchar2 default NULL,
1100 format in varchar2 default NULL,
1101 charset in varchar2 default NULL
1102 );
1103
1104 PROCEDURE policy_highlight_clob_query (
1105 policy_name in varchar2,
1106 document in bfile,
1107 text_query in clob,
1108 restab in out nocopy highlight_tab,
1109 plaintext in boolean default FALSE,
1110 language in varchar2 default NULL,
1111 format in varchar2 default NULL,
1112 charset in varchar2 default NULL
1113 );
1114
1115 /*------------------------------- markup -------------------------------*/
1116 /*
1117 NAME
1118 markup - return marked-up document
1119
1120 DESCRIPTION
1121 Markup takes a document reference and a query, and returns a marked-up
1122 plain text version of the document
1123 The result table should have the following columns:
1124
1125 query_id number (the query id)
1126 document clob (marked-up document)
1127
1128 ARGUMENTS
1129 index_name -- name of the index
1133 query_id -- a query id
1130 textkey -- the document for which to produce highlights
1131 text_query -- the query
1132 restab -- the highlight result table
1134 plaintext -- set to TRUE if plaintext markup is required
1135 tagset -- name of tagset
1136 TEXT_DEFAULT
1137 HTML_DEFAULT
1138 HTML_NAVIGATE
1139 starttag -- the start mark-up tag
1140 endtag -- the end mark-up tag
1141 prevtag -- the navigate to previous highlight mark-up tag
1142 nexttag -- the navigate to next highlight mark-up tag
1143 use_saved_copy -- Can be set to any of these values:
1144 SAVE_COPY_FALLBACK / SAVE_COPY_ERROR / SAVE_COPY_IGNORE
1145 */
1146 PROCEDURE markup (
1147 index_name in varchar2,
1148 textkey in varchar2,
1149 text_query in varchar2,
1150 restab in varchar2,
1151 query_id in number default 0,
1152 plaintext in boolean default FALSE,
1153 tagset in varchar2 default 'TEXT_DEFAULT',
1154 starttag in varchar2 default null,
1155 endtag in varchar2 default null,
1156 prevtag in varchar2 default null,
1157 nexttag in varchar2 default null,
1158 use_saved_copy in number default ctx_doc.save_copy_fallback
1159 );
1160
1161 PROCEDURE markup_clob_query (
1162 index_name in varchar2,
1163 textkey in varchar2,
1164 text_query in clob,
1165 restab in varchar2,
1166 query_id in number default 0,
1167 plaintext in boolean default FALSE,
1168 tagset in varchar2 default 'TEXT_DEFAULT',
1169 starttag in varchar2 default null,
1170 endtag in varchar2 default null,
1171 prevtag in varchar2 default null,
1172 nexttag in varchar2 default null,
1173 use_saved_copy in number default ctx_doc.save_copy_fallback
1174 );
1175
1176 /*------------------------------- markup -------------------------------*/
1177 /*
1178 NAME
1179 markup - return marked-up document
1180
1181 DESCRIPTION
1182 This version of markup returns the result into a CLOB locator
1183 instead of a result table.
1184
1185 NOTES
1186 If result is NULL on entry, a temporary lob is allocated and returned.
1187 it is up to the calling procedure to deallocate this lob.
1188
1189 Any existing contents of the lob locator passed in are cleared.
1190 */
1191 PROCEDURE markup (
1192 index_name in varchar2,
1193 textkey in varchar2,
1194 text_query in varchar2,
1195 restab in out nocopy clob,
1196 plaintext in boolean default FALSE,
1197 tagset in varchar2 default 'TEXT_DEFAULT',
1198 starttag in varchar2 default null,
1199 endtag in varchar2 default null,
1200 prevtag in varchar2 default null,
1201 nexttag in varchar2 default null,
1202 use_saved_copy in number default ctx_doc.save_copy_fallback
1203 );
1204
1205 PROCEDURE markup_clob_query (
1206 index_name in varchar2,
1207 textkey in varchar2,
1208 text_query in clob,
1209 restab in out nocopy clob,
1210 plaintext in boolean default FALSE,
1211 tagset in varchar2 default 'TEXT_DEFAULT',
1212 starttag in varchar2 default null,
1213 endtag in varchar2 default null,
1214 prevtag in varchar2 default null,
1215 nexttag in varchar2 default null,
1216 use_saved_copy in number default ctx_doc.save_copy_fallback
1217 );
1218
1219 /*------------------------------- policy_markup -----------------------------*/
1220 /*
1221 NAME
1222 policy_markup - return marked-up document on demand
1223
1224 DESCRIPTION
1225 This version of markup accepts a policy name and a single VARCHAR2
1226 document. Returns the result into a CLOB locator.
1227
1228 NOTES
1229 If result is NULL on entry, a temporary lob is allocated and returned.
1230 it is up to the calling procedure to deallocate this lob.
1231
1232 Any existing contents of the lob locator passed in are cleared.
1233 */
1234 PROCEDURE policy_markup (
1235 policy_name in varchar2,
1236 document in varchar2,
1237 text_query in varchar2,
1238 restab in out nocopy clob,
1239 plaintext in boolean default FALSE,
1240 tagset in varchar2 default 'TEXT_DEFAULT',
1241 starttag in varchar2 default null,
1242 endtag in varchar2 default null,
1243 prevtag in varchar2 default null,
1244 nexttag in varchar2 default null,
1245 language in varchar2 default NULL,
1246 format in varchar2 default NULL,
1247 charset in varchar2 default NULL
1248 );
1249
1250 PROCEDURE policy_markup_clob_query (
1251 policy_name in varchar2,
1252 document in varchar2,
1253 text_query in clob,
1254 restab in out nocopy clob,
1255 plaintext in boolean default FALSE,
1256 tagset in varchar2 default 'TEXT_DEFAULT',
1257 starttag in varchar2 default null,
1258 endtag in varchar2 default null,
1259 prevtag in varchar2 default null,
1260 nexttag in varchar2 default null,
1264 );
1261 language in varchar2 default NULL,
1262 format in varchar2 default NULL,
1263 charset in varchar2 default NULL
1265
1266 /*------------------------------- policy_markup -----------------------------*/
1267 /*
1268 NAME
1269 policy_markup - return marked-up document on demand
1270
1271 DESCRIPTION
1272 This version of markup accepts a policy name and a single CLOB
1273 document. Returns the result into a CLOB locator.
1274
1275 NOTES
1276 If result is NULL on entry, a temporary lob is allocated and returned.
1277 it is up to the calling procedure to deallocate this lob.
1278
1279 Any existing contents of the lob locator passed in are cleared.
1280 */
1281 PROCEDURE policy_markup (
1282 policy_name in varchar2,
1283 document in clob,
1284 text_query in varchar2,
1285 restab in out nocopy clob,
1286 plaintext in boolean default FALSE,
1287 tagset in varchar2 default 'TEXT_DEFAULT',
1288 starttag in varchar2 default null,
1289 endtag in varchar2 default null,
1290 prevtag in varchar2 default null,
1291 nexttag in varchar2 default null,
1292 language in varchar2 default NULL,
1293 format in varchar2 default NULL,
1294 charset in varchar2 default NULL
1295 );
1296
1297 PROCEDURE policy_markup_clob_query (
1298 policy_name in varchar2,
1299 document in clob,
1300 text_query in clob,
1301 restab in out nocopy clob,
1302 plaintext in boolean default FALSE,
1303 tagset in varchar2 default 'TEXT_DEFAULT',
1304 starttag in varchar2 default null,
1305 endtag in varchar2 default null,
1306 prevtag in varchar2 default null,
1307 nexttag in varchar2 default null,
1308 language in varchar2 default NULL,
1309 format in varchar2 default NULL,
1310 charset in varchar2 default NULL
1311 );
1312
1313 /*------------------------------- policy_markup -----------------------------*/
1314 /*
1315 NAME
1316 policy_markup - return marked-up document on demand
1317
1318 DESCRIPTION
1319 This version of markup accepts a policy name and a single BLOB
1320 document. Returns the result into a CLOB locator.
1321
1322 NOTES
1323 If result is NULL on entry, a temporary lob is allocated and returned.
1324 it is up to the calling procedure to deallocate this lob.
1325
1326 Any existing contents of the lob locator passed in are cleared.
1327 */
1328 PROCEDURE policy_markup (
1329 policy_name in varchar2,
1330 document in blob,
1331 text_query in varchar2,
1332 restab in out nocopy clob,
1333 plaintext in boolean default FALSE,
1334 tagset in varchar2 default 'TEXT_DEFAULT',
1335 starttag in varchar2 default null,
1336 endtag in varchar2 default null,
1337 prevtag in varchar2 default null,
1338 nexttag in varchar2 default null,
1339 language in varchar2 default NULL,
1340 format in varchar2 default NULL,
1341 charset in varchar2 default NULL
1342 );
1343
1344 PROCEDURE policy_markup_clob_query (
1345 policy_name in varchar2,
1346 document in blob,
1347 text_query in clob,
1348 restab in out nocopy clob,
1349 plaintext in boolean default FALSE,
1350 tagset in varchar2 default 'TEXT_DEFAULT',
1351 starttag in varchar2 default null,
1352 endtag in varchar2 default null,
1353 prevtag in varchar2 default null,
1354 nexttag in varchar2 default null,
1355 language in varchar2 default NULL,
1356 format in varchar2 default NULL,
1357 charset in varchar2 default NULL
1358 );
1359
1360 /*------------------------------- policy_markup ----------------------------*/
1361 /*
1362 NAME
1363 policy_markup - return marked-up document on demand
1364
1365 DESCRIPTION
1366 This version of markup accepts a policy name and a single BFILE
1367 document. Returns the result into a CLOB locator.
1368
1369 NOTES
1370 If result is NULL on entry, a temporary lob is allocated and returned.
1371 it is up to the calling procedure to deallocate this lob.
1372
1373 Any existing contents of the lob locator passed in are cleared.
1374 */
1375 PROCEDURE policy_markup (
1376 policy_name in varchar2,
1377 document in bfile,
1378 text_query in varchar2,
1379 restab in out nocopy clob,
1380 plaintext in boolean default FALSE,
1381 tagset in varchar2 default 'TEXT_DEFAULT',
1382 starttag in varchar2 default null,
1383 endtag in varchar2 default null,
1384 prevtag in varchar2 default null,
1385 nexttag in varchar2 default null,
1386 language in varchar2 default NULL,
1387 format in varchar2 default NULL,
1388 charset in varchar2 default NULL
1389 );
1390
1391 PROCEDURE policy_markup_clob_query (
1392 policy_name in varchar2,
1393 document in bfile,
1394 text_query in clob,
1395 restab in out nocopy clob,
1399 endtag in varchar2 default null,
1396 plaintext in boolean default FALSE,
1397 tagset in varchar2 default 'TEXT_DEFAULT',
1398 starttag in varchar2 default null,
1400 prevtag in varchar2 default null,
1401 nexttag in varchar2 default null,
1402 language in varchar2 default NULL,
1403 format in varchar2 default NULL,
1404 charset in varchar2 default NULL
1405 );
1406
1407 /*----------------------------- snippet --------- ----------------------*/
1408 /* NAME
1409 snippet - return snippet (or kwic or concordance) for a given document
1410
1411 DESCRIPTION
1412 This version of snippet accepts a index name and a key to specify
1413 a document. Returns the snippet result.
1414
1415 NOTES
1416 */
1417 function snippet (
1418 index_name IN VARCHAR2,
1419 textkey IN VARCHAR2,
1420 text_query IN VARCHAR2,
1421 starttag IN VARCHAR2 default '<b>',
1422 endtag IN VARCHAR2 default '</b>',
1423 entity_translation IN BOOLEAN default TRUE,
1424 separator IN VARCHAR2 default '<b>...</b>',
1425 radius IN NUMBER default 25,
1426 max_length IN NUMBER default 150,
1427 use_saved_copy IN NUMBER default ctx_doc.save_copy_fallback
1428 ) return varchar2;
1429
1430 function snippet_clob_query (
1431 index_name IN VARCHAR2,
1432 textkey IN VARCHAR2,
1433 text_query IN CLOB,
1434 starttag IN VARCHAR2 default '<b>',
1435 endtag IN VARCHAR2 default '</b>',
1436 entity_translation IN BOOLEAN default TRUE,
1437 separator IN VARCHAR2 default '<b>...</b>',
1438 radius IN NUMBER default 25,
1439 max_length IN NUMBER default 150,
1440 use_saved_copy IN NUMBER default ctx_doc.save_copy_fallback
1441 ) return varchar2;
1442
1443
1444 /*----------------------------- policy_snippet ----------------------*/
1445 /* NAME
1446 policy_snippet - return snippet (kwic or concordaace) for a given document
1447
1448 DESCRIPTION
1449 This version of snippet accepts a policy name and a single varchar2
1450 document. Returns the snippet result.
1451
1452 NOTES
1453 */
1454 function policy_snippet (
1455 policy_name IN VARCHAR2,
1456 document IN VARCHAR2,
1457 text_query IN VARCHAR2,
1458 language IN VARCHAR2 default NULL,
1459 format IN VARCHAR2 default NULL,
1460 charset IN VARCHAR2 default NULL,
1461 starttag IN VARCHAR2 default '<b>',
1462 endtag IN VARCHAR2 default '</b>',
1463 entity_translation IN BOOLEAN default TRUE,
1464 separator IN VARCHAR2 default '<b>...</b>',
1465 radius IN NUMBER default 25,
1466 max_length IN NUMBER default 150
1467 ) return varchar2;
1468
1469 function policy_snippet_clob_query (
1470 policy_name IN VARCHAR2,
1471 document IN VARCHAR2,
1472 text_query IN CLOB,
1473 language IN VARCHAR2 default NULL,
1474 format IN VARCHAR2 default NULL,
1475 charset IN VARCHAR2 default NULL,
1476 starttag IN VARCHAR2 default '<b>',
1477 endtag IN VARCHAR2 default '</b>',
1478 entity_translation IN BOOLEAN default TRUE,
1479 separator IN VARCHAR2 default '<b>...</b>',
1480 radius IN NUMBER default 25,
1481 max_length IN NUMBER default 150
1482 ) return varchar2;
1483
1484 /*----------------------------- policy_snippet ----------------------*/
1485 /* NAME
1486 policy_snippet - return snippet (kwic or concordaace) for a given document
1487
1488 DESCRIPTION
1489 This version of snippet accepts a policy name and a single clob
1490 document. Returns the snippet result.
1491
1492 NOTES
1493 */
1494 function policy_snippet (
1495 policy_name IN VARCHAR2,
1496 document IN CLOB,
1497 text_query IN VARCHAR2,
1498 language IN VARCHAR2 default NULL,
1499 format IN VARCHAR2 default NULL,
1500 charset IN VARCHAR2 default NULL,
1501 starttag IN VARCHAR2 default '<b>',
1502 endtag IN VARCHAR2 default '</b>',
1503 entity_translation IN BOOLEAN default TRUE,
1504 separator IN VARCHAR2 default '<b>...</b>',
1505 radius IN NUMBER default 25,
1506 max_length IN NUMBER default 150
1507 ) return varchar2;
1508
1509 function policy_snippet_clob_query (
1510 policy_name IN VARCHAR2,
1511 document IN CLOB,
1512 text_query IN CLOB,
1513 language IN VARCHAR2 default NULL,
1514 format IN VARCHAR2 default NULL,
1515 charset IN VARCHAR2 default NULL,
1516 starttag IN VARCHAR2 default '<b>',
1517 endtag IN VARCHAR2 default '</b>',
1518 entity_translation IN BOOLEAN default TRUE,
1519 separator IN VARCHAR2 default '<b>...</b>',
1520 radius IN NUMBER default 25,
1521 max_length IN NUMBER default 150
1522 ) return varchar2;
1523
1524 /*----------------------------- policy_snippet ----------------------*/
1525 /* NAME
1526 policy_snippet - return snippet (kwic or concordaace) for a given document
1527
1528 DESCRIPTION
1529 This version of snippet accepts a policy name and a single BLOB
1530 document. Returns the snippet result.
1531
1532 NOTES
1533 */
1534 function policy_snippet (
1538 language IN VARCHAR2 default NULL,
1535 policy_name IN VARCHAR2,
1536 document IN BLOB,
1537 text_query IN VARCHAR2,
1539 format IN VARCHAR2 default NULL,
1540 charset IN VARCHAR2 default NULL,
1541 starttag IN VARCHAR2 default '<b>',
1542 endtag IN VARCHAR2 default '</b>',
1543 entity_translation IN BOOLEAN default TRUE,
1544 separator IN VARCHAR2 default '<b>...</b>',
1545 radius IN NUMBER default 25,
1546 max_length IN NUMBER default 150
1547 ) return varchar2;
1548
1549 function policy_snippet_clob_query (
1550 policy_name IN VARCHAR2,
1551 document IN BLOB,
1552 text_query IN CLOB,
1553 language IN VARCHAR2 default NULL,
1554 format IN VARCHAR2 default NULL,
1555 charset IN VARCHAR2 default NULL,
1556 starttag IN VARCHAR2 default '<b>',
1557 endtag IN VARCHAR2 default '</b>',
1558 entity_translation IN BOOLEAN default TRUE,
1559 separator IN VARCHAR2 default '<b>...</b>',
1560 radius IN NUMBER default 25,
1561 max_length IN NUMBER default 150
1562 ) return varchar2;
1563
1564 /*----------------------------- policy_snippet ----------------------*/
1565 /* NAME
1566 policy_snippet - return snippet (kwic or concordaace) for a given document
1567
1568 DESCRIPTION
1569 This version of snippet accepts a policy name and a single BLOB
1570 document. Returns the snippet result.
1571
1572 NOTES
1573 */
1574 function policy_snippet (
1575 policy_name IN VARCHAR2,
1576 document IN BFILE,
1577 text_query IN VARCHAR2,
1578 language IN VARCHAR2 default NULL,
1579 format IN VARCHAR2 default NULL,
1580 charset IN VARCHAR2 default NULL,
1581 starttag IN VARCHAR2 default '<b>',
1582 endtag IN VARCHAR2 default '</b>',
1583 entity_translation IN BOOLEAN default TRUE,
1584 separator IN VARCHAR2 default '<b>...</b>',
1585 radius IN NUMBER default 25,
1586 max_length IN NUMBER default 150
1587 ) return varchar2;
1588
1589 function policy_snippet_clob_query (
1590 policy_name IN VARCHAR2,
1591 document IN BFILE,
1592 text_query IN CLOB,
1593 language IN VARCHAR2 default NULL,
1594 format IN VARCHAR2 default NULL,
1595 charset IN VARCHAR2 default NULL,
1596 starttag IN VARCHAR2 default '<b>',
1597 endtag IN VARCHAR2 default '</b>',
1598 entity_translation IN BOOLEAN default TRUE,
1599 separator IN VARCHAR2 default '<b>...</b>',
1600 radius IN NUMBER default 25,
1601 max_length IN NUMBER default 150
1602 ) return varchar2;
1603
1604 /*----------------------------- pkencode --------------------------------*/
1605 /*
1606 NAME
1607 PKENCODE(pk1,pk2,pk3,pk4,pk5,pk6,pk7,pk8,pk9,pk10,pk11,pk12,pk13,
1608 pk14,pk15,pk16)
1609 DESCRIPTION
1610 encoding a list of pk strings into one; the resulting string
1611 has the ',' and '\' escapped by an extra '\'.
1612 comma ',' is used as delimiter between pk's.
1613 it is used in composite textkeys
1614 e.g., ('p,1','p\2','p3') => 'p\,1,p\\2,p3'
1615
1616 ARGUMENTS
1617 pk1-pk16 - textkey list
1618
1619 RETURN
1620 encoded pkstring
1621 */
1622 FUNCTION pkencode(
1623 pk1 IN varchar2, pk2 IN varchar2 default NULL,
1624 pk3 IN varchar2 default NULL, pk4 IN varchar2 default NULL,
1625 pk5 IN varchar2 default NULL, pk6 IN varchar2 default NULL,
1626 pk7 IN varchar2 default NULL, pk8 IN varchar2 default NULL,
1627 pk9 IN varchar2 default NULL, pk10 IN varchar2 default NULL,
1628 pk11 IN varchar2 default NULL, pk12 IN varchar2 default NULL,
1629 pk13 IN varchar2 default NULL, pk14 IN varchar2 default NULL,
1630 pk15 IN varchar2 default NULL, pk16 IN varchar2 default NULL
1631 )
1632 return varchar2;
1633 PRAGMA RESTRICT_REFERENCES(pkencode, WNDS, WNPS, RNDS, RNPS);
1634
1635 /*----------------------------- ifilter ----------------------------------*/
1636 /*
1637 NAME
1638 ifilter
1639
1640 DESCRIPTION
1641 Takes binary data(BLOB), filters the data through INSO and writes the
1642 text version to a CLOB
1643
1644 ARGUMENTS
1645 data (IN) BLOB
1646 TEXT (IN OUT) CLOB
1647
1648 NOTES
1649 text is APPENDed to the CLOB -- so existing contents are not
1650 disturbed. It is the client's responsibility to ensure that
1651 the CLOB is trucated before the ifilter call if the existing
1652 content is not needed.
1653
1654 RETURN
1655 */
1656 PROCEDURE ifilter(
1657 data IN blob,
1658 text IN OUT nocopy clob
1659 );
1660
1661 END ctx_doc;