The Oracle Text Reference for 9iR2 says that the INPATH
operator (that is only available for PATH_SECTION_GROUPs) does not work
with highlighting - and when you try it out, you get an error message - FAIR
ENOUGH. The manual does however not say whether highlighting is compatible with
PATH_SECTION_GROUP when using the WITHIN operator. When you try it out it does
NOT give an error message. But it seems to give the wrong result (which is worse
than giving an error message). Are highlighting and PATH_SECTION_GROUP
incompatiable regardless of operator (or is it a bug)??
Example is given below. Any help is appreciated.
Regards,
Michael Garfield S�rensen, CeDeT
Example (Oracle9iR2 9.0.2.1 EE on
Windows2000 Professional SP3 (DK)):
SQL> connect
system/*******
Forbindelsen er oprettet.
SQL> grant ctxapp to scott;
Forbindelsen er oprettet.
SQL> grant ctxapp to scott;
Adgang er givet (Grant).
SQL> connect scott/*****
Forbindelsen er oprettet.
SQL> CREATE TABLE my_content(
2 normid VARCHAR2(255) NOT NULL,
3 content CLOB NOT NULL,
4 CONSTRAINT my_content_pk PRIMARY KEY(normid))
5 LOB(content) STORE AS (CACHE);
Forbindelsen er oprettet.
SQL> CREATE TABLE my_content(
2 normid VARCHAR2(255) NOT NULL,
3 content CLOB NOT NULL,
4 CONSTRAINT my_content_pk PRIMARY KEY(normid))
5 LOB(content) STORE AS (CACHE);
Tabel er oprettet.
SQL>
SQL> BEGIN
2 ctx_ddl.create_section_group('my_content_sg','PATH_SECTION_GROUP');
3 --
4 END;
5 /
SQL> BEGIN
2 ctx_ddl.create_section_group('my_content_sg','PATH_SECTION_GROUP');
3 --
4 END;
5 /
PL/SQL-procedure er udf�rt.
SQL>
SQL> CREATE INDEX my_content_ix ON my_content(content)
2 INDEXTYPE IS ctxsys.context
3 PARAMETERS('SECTION GROUP my_content_sg');
SQL> CREATE INDEX my_content_ix ON my_content(content)
2 INDEXTYPE IS ctxsys.context
3 PARAMETERS('SECTION GROUP my_content_sg');
Indeks er oprettet.
SQL>
SQL> INSERT INTO my_content(normid,content)
2 VALUES('d1','<BOOK TITLE="Tale of Two Cities">
3 <AUTHORS><AUTHOR NAME="Charles Dickens">Born in England in the town
Stratford Upon Avon</AUTHOR></AUTHORS>
4 <TEXT>It was the best of times.
5 ...
6 </TEXT></BOOK>');
SQL> INSERT INTO my_content(normid,content)
2 VALUES('d1','<BOOK TITLE="Tale of Two Cities">
3 <AUTHORS><AUTHOR NAME="Charles Dickens">Born in England in the town
Stratford Upon Avon</AUTHOR></AUTHORS>
4 <TEXT>It was the best of times.
5 ...
6 </TEXT></BOOK>');
1 r�kke er oprettet.
SQL>
SQL> BEGIN
2 ctx_ddl.sync_index('scott.my_content_ix');
3 END;
4 /
SQL> BEGIN
2 ctx_ddl.sync_index('scott.my_content_ix');
3 END;
4 /
PL/SQL-procedure er udf�rt.
SQL>
SQL> ANALYZE TABLE my_content COMPUTE STATISTICS;
SQL> ANALYZE TABLE my_content COMPUTE STATISTICS;
Tabel er analyseret.
SQL>
SQL> COLUMN normid FORMAT a20
SQL> PROMPT INPATH works
INPATH works
SQL> SELECT /*+ FIRST_ROWS */ normid,SCORE(1) FROM my_content
2 WHERE CONTAINS(content,'Stratford INPATH(BOOK)',1)>0
3 ORDER BY SCORE(1) DESC;
SQL> COLUMN normid FORMAT a20
SQL> PROMPT INPATH works
INPATH works
SQL> SELECT /*+ FIRST_ROWS */ normid,SCORE(1) FROM my_content
2 WHERE CONTAINS(content,'Stratford INPATH(BOOK)',1)>0
3 ORDER BY SCORE(1) DESC;
NORMID
SCORE(1)
-------------------- ----------
d1 3
-------------------- ----------
d1 3
SQL> PROMPT WITHIN works
WITHIN works
SQL> SELECT /*+ FIRST_ROWS */ normid,SCORE(1) FROM my_content
2 WHERE CONTAINS(content,'Stratford WITHIN BOOK',1)>0
3 ORDER BY SCORE(1) DESC;
WITHIN works
SQL> SELECT /*+ FIRST_ROWS */ normid,SCORE(1) FROM my_content
2 WHERE CONTAINS(content,'Stratford WITHIN BOOK',1)>0
3 ORDER BY SCORE(1) DESC;
NORMID
SCORE(1)
-------------------- ----------
d1 3
-------------------- ----------
d1 3
SQL>
SQL> SET SERVEROUTPUT ON SIZE 1000000;
SQL> PROMPT INPATH with highlighting does not work!
INPATH with highlighting does not work!
SQL> DECLARE
2 h_tab ctx_doc.highlight_tab;
3 BEGIN
4 ctx_doc.highlight('MY_CONTENT_IX','d1','Stratford INPATH(BOOK)',h_tab,FALSE);
5 DBMS_OUTPUT.PUT_LINE(h_tab.COUNT);
6 FOR i IN 1..h_tab.COUNT LOOP
7 DBMS_OUTPUT.PUT_LINE('Highlight('||i||'):Offset='||h_tab(i).offset||',Length='||h_tab(i).length);
8 END LOOP;
9 END;
10 /
DECLARE
*
FEJL i linie 1:
ORA-20000: Oracle Text-fejl:
ORA-06512: ved "CTXSYS.DRUE", linje 157
ORA-06512: ved "CTXSYS.CTX_DOC", linje 914
ORA-06512: ved linje 4
SQL> SET SERVEROUTPUT ON SIZE 1000000;
SQL> PROMPT INPATH with highlighting does not work!
INPATH with highlighting does not work!
SQL> DECLARE
2 h_tab ctx_doc.highlight_tab;
3 BEGIN
4 ctx_doc.highlight('MY_CONTENT_IX','d1','Stratford INPATH(BOOK)',h_tab,FALSE);
5 DBMS_OUTPUT.PUT_LINE(h_tab.COUNT);
6 FOR i IN 1..h_tab.COUNT LOOP
7 DBMS_OUTPUT.PUT_LINE('Highlight('||i||'):Offset='||h_tab(i).offset||',Length='||h_tab(i).length);
8 END LOOP;
9 END;
10 /
DECLARE
*
FEJL i linie 1:
ORA-20000: Oracle Text-fejl:
ORA-06512: ved "CTXSYS.DRUE", linje 157
ORA-06512: ved "CTXSYS.CTX_DOC", linje 914
ORA-06512: ved linje 4
SQL>
SQL> PROMPT WITHIN with highlighting seems to be supposed to work - but
does it?
WITHIN with highlighting seems to be supposed to work - but does it?
SQL> DECLARE
2 h_tab ctx_doc.highlight_tab;
3 BEGIN
4 ctx_doc.highlight('MY_CONTENT_IX','d1','Stratford WITHIN BOOK',h_tab,FALSE);
5 DBMS_OUTPUT.PUT_LINE('This should be 1, but it is:');
6 DBMS_OUTPUT.PUT_LINE('----------------------------');
7 DBMS_OUTPUT.PUT_LINE(h_tab.COUNT);
8 DBMS_OUTPUT.PUT_LINE('!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
9 FOR i IN 1..h_tab.COUNT LOOP
10 DBMS_OUTPUT.PUT_LINE('Highlight('||i||'):Offset='||h_tab(i).offset||',Length='||h_tab(i).length);
11 END LOOP;
12 END;
13 /
This should be 1, but it is:
----------------------------
0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PL/SQL-procedure er udf�rt.
