Home » Server Options » Text & interMedia » DetailDatastore
| DetailDatastore [message #133028] |
Wed, 17 August 2005 06:52  |
kumarvision25
Messages: 19 Registered: August 2005 Location: a
|
Junior Member |

|
|
hi all,
i have created the detailed datastore object i need to know how to call in query.
CREATE TABLE MY_MASTER (ARTICLE_ID NUMBER PRIMARY KEY,AUTHOR VARCHAR2(30),
TITLE VARCHAR2(50),BODY CHAR(1));
/
CREATE TABLE MY_DETAIL (ARTICLE_ID NUMBER,SEQ NUMBER,TEXT CLOB);
/
COMMIT;
ALTER TABLE MY_DETAIL ADD CONSTRAINT MY_DETAIL_FK
FOREIGN KEY (ARTICLE_ID)
REFERENCES MY_MASTER (ARTICLE_ID) ;
BEGIN
CTX_DDL.CREATE_PREFERENCE('MY_DETAIL_PREF', 'DETAIL_DATASTORE');
CTX_DDL.set_attribute('MY_DETAIL_PREF', 'binary', 'true');
CTX_DDL.set_attribute('MY_DETAIL_PREF', 'detail_table', 'MY_DETAIL');
CTX_DDL.set_attribute('MY_DETAIL_PREF', 'detail_key', 'ARTICLE_ID');
CTX_DDL.set_attribute('MY_DETAIL_PREF', 'detail_lineno', 'SEQ');
CTX_DDL.set_attribute('MY_DETAIL_PREF', 'detail_text', 'TEXT');
END;
CREATE INDEX MASTER_DETAIL_INDEX ON MY_MASTER(BODY) INDEXTYPE IS CTXSYS.CONTEXT
PARAMETERS('DATASTORE MY_DETAIL_PREF');
CREATE INDEX MASTER_DETAIL_INDEX
ON MY_MASTER(BODY)
INDEXTYPE IS CTXSYS.CONTEXT
PARAMETERS ('datastore CTXSYS.MY_DETAIL_PREF')
/
INSERT INTO MY_MASTER VALUES (101,'RISHI','DATASTORE','Y');
INSERT INTO MY_DETAIL VALUES(101,'00002','The direct datastore');
COMMIT;
I need to know how to query the my_detail table.
thanks
shashi
|
|
|
|
| Re: DetailDatastore [message #133130 is a reply to message #133028] |
Wed, 17 August 2005 15:33   |
 |
Barbara Boehmer
Messages: 7669 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
-- setup:
scott@ORA92> CREATE TABLE MY_MASTER
2 (ARTICLE_ID NUMBER PRIMARY KEY,
3 AUTHOR VARCHAR2(30),
4 TITLE VARCHAR2(50),
5 BODY CHAR(1))
6 /
Table created.
scott@ORA92> CREATE TABLE MY_DETAIL
2 (ARTICLE_ID NUMBER,
3 SEQ NUMBER,
4 TEXT CLOB)
5 /
Table created.
scott@ORA92> ALTER TABLE MY_DETAIL
2 ADD CONSTRAINT MY_DETAIL_FK
3 FOREIGN KEY (ARTICLE_ID)
4 REFERENCES MY_MASTER (ARTICLE_ID)
5 /
Table altered.
scott@ORA92> BEGIN
2 CTX_DDL.CREATE_PREFERENCE ('MY_DETAIL_PREF', 'DETAIL_DATASTORE');
3 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'binary', 'true');
4 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_table', 'MY_DETAIL');
5 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_key', 'ARTICLE_ID');
6 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_lineno', 'SEQ');
7 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_text', 'TEXT');
8 END;
9 /
PL/SQL procedure successfully completed.
scott@ORA92> CREATE INDEX MASTER_DETAIL_INDEX
2 ON MY_MASTER (BODY)
3 INDEXTYPE IS CTXSYS.CONTEXT
4 PARAMETERS ('DATASTORE MY_DETAIL_PREF')
5 /
Index created.
-- insert data:
scott@ORA92> INSERT INTO MY_MASTER
2 VALUES (101, 'RISHI', 'DATASTORE', 'Y')
3 /
1 row created.
scott@ORA92> INSERT INTO MY_MASTER
2 VALUES (102, 'BARBARA', 'TEST', 'Y')
3 /
1 row created.
scott@ORA92> INSERT INTO MY_DETAIL
2 VALUES (101, '00002', 'The direct datastore')
3 /
1 row created.
scott@ORA92> INSERT INTO MY_DETAIL
2 VALUES (102, '00003', 'Something else ... whatever')
3 /
1 row created.
scott@ORA92> COMMIT
2 /
Commit complete.
-- synchronize index:
scott@ORA92> EXEC ctx_ddl.sync_index ('MASTER_DETAIL_INDEX')
PL/SQL procedure successfully completed.
-- queries:
scott@ORA92> SELECT *
2 FROM my_master
3 WHERE CONTAINS (body, 'direct') > 0
4 /
ARTICLE_ID AUTHOR TITLE B
---------- ------------------------------ -------------------------------------------------- -
101 RISHI DATASTORE Y
scott@ORA92> SELECT *
2 FROM my_master
3 WHERE CONTAINS (body, 'something') > 0
4 /
ARTICLE_ID AUTHOR TITLE B
---------- ------------------------------ -------------------------------------------------- -
102 BARBARA TEST Y
scott@ORA92>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: DetailDatastore [message #133211 is a reply to message #133209] |
Thu, 18 August 2005 01:28   |
 |
Barbara Boehmer
Messages: 7669 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
Please copy and paste the following to a .sql file, start that file, then copy and paste the results of the complete run.
drop table my_detail
/
drop table my_master
/
exec CTX_DDL.drop_PREFERENCE ('MY_DETAIL_PREF')
CREATE TABLE MY_MASTER
(ARTICLE_ID NUMBER PRIMARY KEY,
AUTHOR VARCHAR2(30),
TITLE VARCHAR2(50),
BODY CHAR(1))
/
CREATE TABLE MY_DETAIL
(ARTICLE_ID NUMBER,
SEQ NUMBER,
TEXT CLOB)
/
ALTER TABLE MY_DETAIL
ADD CONSTRAINT MY_DETAIL_FK
FOREIGN KEY (ARTICLE_ID)
REFERENCES MY_MASTER (ARTICLE_ID)
/
BEGIN
CTX_DDL.CREATE_PREFERENCE ('MY_DETAIL_PREF', 'DETAIL_DATASTORE');
CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'binary', 'true');
CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_table', 'MY_DETAIL');
CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_key', 'ARTICLE_ID');
CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_lineno', 'SEQ');
CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_text', 'TEXT');
END;
/
CREATE INDEX MASTER_DETAIL_INDEX
ON MY_MASTER (BODY)
INDEXTYPE IS CTXSYS.CONTEXT
PARAMETERS ('DATASTORE MY_DETAIL_PREF')
/
INSERT INTO MY_MASTER
VALUES (101, 'RISHI', 'DATASTORE', 'Y')
/
INSERT INTO MY_MASTER
VALUES (102, 'BARBARA', 'TEST', 'Y')
/
INSERT INTO MY_DETAIL
VALUES (101, '00002', 'The direct datastore')
/
INSERT INTO MY_DETAIL
VALUES (102, '00003', 'Something else ... whatever')
/
COMMIT
/
EXEC ctx_ddl.sync_index ('MASTER_DETAIL_INDEX')
SELECT token_text
FROM dr$master_detail_index$i
/
SELECT *
FROM my_master
WHERE CONTAINS (body, 'direct') > 0
/
SELECT *
FROM my_master
WHERE CONTAINS (body, 'something') > 0
/
|
|
|
|
| Re: DetailDatastore [message #133212 is a reply to message #133211] |
Thu, 18 August 2005 01:40   |
kumarvision25
Messages: 19 Registered: August 2005 Location: a
|
Junior Member |

|
|
yes i have copied and paste and i have run it but still the same output is coming....
SQL>
1 drop table my_detail
2 /
3 drop table my_master
4 /
5 exec CTX_DDL.drop_PREFERENCE ('MY_DETAIL_PREF')
6 CREATE TABLE MY_MASTER
7 (ARTICLE_ID NUMBER PRIMARY KEY,
8 AUTHOR VARCHAR2(30),
9 TITLE VARCHAR2(50),
10 BODY CHAR(1))
11 /
12 CREATE TABLE MY_DETAIL
13 (ARTICLE_ID NUMBER,
14 SEQ NUMBER,
15 TEXT CLOB)
16 /
17 ALTER TABLE MY_DETAIL
18 ADD CONSTRAINT MY_DETAIL_FK
19 FOREIGN KEY (ARTICLE_ID)
20 REFERENCES MY_MASTER (ARTICLE_ID)
21 /
22 BEGIN
23 CTX_DDL.CREATE_PREFERENCE ('MY_DETAIL_PREF', 'DETAIL_DATASTORE');
24 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'binary', 'true');
25 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_table', 'MY_DETAIL');
26 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_key', 'ARTICLE_ID');
27 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_lineno', 'SEQ');
28 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_text', 'TEXT');
29 END;
30 /
31 CREATE INDEX MASTER_DETAIL_INDEX
32 ON MY_MASTER (BODY)
33 INDEXTYPE IS CTXSYS.CONTEXT
34 PARAMETERS ('DATASTORE MY_DETAIL_PREF')
35 /
36 INSERT INTO MY_MASTER
37 VALUES (101, 'RISHI', 'DATASTORE', 'Y')
38 /
39 INSERT INTO MY_MASTER
40 VALUES (102, 'BARBARA', 'TEST', 'Y')
41 /
42 INSERT INTO MY_DETAIL
43 VALUES (101, '00002', 'The direct datastore')
44 /
45 INSERT INTO MY_DETAIL
46 VALUES (102, '00003', 'Something else ... whatever')
47 /
48 COMMIT
49 /
50 EXEC ctx_ddl.sync_index ('MASTER_DETAIL_INDEX')
51 SELECT token_text
52 FROM dr$master_detail_index$i
53 /
54 SELECT *
55 FROM my_master
56 WHERE CONTAINS (body, 'direct') > 0
57 /
58 SELECT *
59 FROM my_master
60* WHERE CONTAINS (body, 'something') > 0
SQL> SELECT *
2 FROM my_master
3 WHERE CONTAINS (body, 'something') > 0
4 /
no rows selected
SQL> SELECT *
2 FROM my_master;
ARTICLE_ID AUTHOR
---------- ------------------------------
TITLE B
-------------------------------------------------- -
101 RISHI
DATASTORE Y
102 BARBARA
TEST Y
|
|
|
|
|
|
|
|
|
|
| Re: DetailDatastore [message #133217 is a reply to message #133216] |
Thu, 18 August 2005 02:00   |
kumarvision25
Messages: 19 Registered: August 2005 Location: a
|
Junior Member |

|
|
SQL> SET FEEDBACK ON
SQL>
1 drop table my_detail
2 /
3 drop table my_master
4 /
5 exec CTX_DDL.drop_PREFERENCE ('MY_DETAIL_PREF')
6 CREATE TABLE MY_MASTER
7 (ARTICLE_ID NUMBER PRIMARY KEY,
8 AUTHOR VARCHAR2(30),
9 TITLE VARCHAR2(50),
10 BODY CHAR(1))
11 /
12 CREATE TABLE MY_DETAIL
13 (ARTICLE_ID NUMBER,
14 SEQ NUMBER,
15 TEXT CLOB)
16 /
17 ALTER TABLE MY_DETAIL
18 ADD CONSTRAINT MY_DETAIL_FK
19 FOREIGN KEY (ARTICLE_ID)
20 REFERENCES MY_MASTER (ARTICLE_ID)
21 /
22 BEGIN
23 CTX_DDL.CREATE_PREFERENCE ('MY_DETAIL_PREF', 'DETAIL_DATASTORE');
24 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'binary', 'true');
25 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_table', 'MY_DETAIL');
26 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_key', 'ARTICLE_ID');
27 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_lineno', 'SEQ');
28 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_text', 'TEXT');
29 END;
30 /
31 CREATE INDEX MASTER_DETAIL_INDEX
32 ON MY_MASTER (BODY)
33 INDEXTYPE IS CTXSYS.CONTEXT
34 PARAMETERS ('DATASTORE MY_DETAIL_PREF')
35 /
36 INSERT INTO MY_MASTER
37 VALUES (101, 'RISHI', 'DATASTORE', 'Y')
38 /
39 INSERT INTO MY_MASTER
40 VALUES (102, 'BARBARA', 'TEST', 'Y')
41 /
42 INSERT INTO MY_DETAIL
43 VALUES (101, '00002', 'The direct datastore')
44 /
45 INSERT INTO MY_DETAIL
46 VALUES (102, '00003', 'Something else ... whatever')
47 /
48 COMMIT
49 /
50 EXEC ctx_ddl.sync_index ('MASTER_DETAIL_INDEX')
51 SELECT token_text
52 FROM dr$master_detail_index$i
53 /
54 SELECT *
55 FROM my_master
56 WHERE CONTAINS (body, 'direct') > 0
57 /
58 SELECT *
59 FROM my_master
60* WHERE CONTAINS (body, 'something') > 0
SQL> SELECT *
2 FROM my_master
3 WHERE CONTAINS (body, 'something') > 0
4 /
no rows selected
|
|
|
|
|
|
|
|
|
|
| Re: DetailDatastore [message #133230 is a reply to message #133221] |
Thu, 18 August 2005 03:09   |
kumarvision25
Messages: 19 Registered: August 2005 Location: a
|
Junior Member |

|
|
SQL>
1 drop table my_detail
2 /
3 drop table my_master
4 /
5 exec CTX_DDL.drop_PREFERENCE ('MY_DETAIL_PREF')
6 CREATE TABLE MY_MASTER
7 (ARTICLE_ID NUMBER PRIMARY KEY,
8 AUTHOR VARCHAR2(30),
9 TITLE VARCHAR2(50),
10 BODY CHAR(1))
11 /
12 CREATE TABLE MY_DETAIL
13 (ARTICLE_ID NUMBER,
14 SEQ NUMBER,
15 TEXT CLOB)
16 /
17 ALTER TABLE MY_DETAIL
18 ADD CONSTRAINT MY_DETAIL_FK
19 FOREIGN KEY (ARTICLE_ID)
20 REFERENCES MY_MASTER (ARTICLE_ID)
21 /
22 BEGIN
23 CTX_DDL.CREATE_PREFERENCE ('MY_DETAIL_PREF', 'DETAIL_DATASTORE');
24 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'binary', 'true');
25 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_table', 'MY_DETAI
26 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_key', 'ARTICLE_ID
27 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_lineno', 'SEQ');
28 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_text', 'TEXT');
29 END;
30 /
31 CREATE INDEX M_DETAIL_INDEX
32 ON MY_MASTER (BODY)
33 INDEXTYPE IS CTXSYS.CONTEXT
34 PARAMETERS ('DATASTORE MY_DETAIL_PREF')
35 /
36 INSERT INTO MY_MASTER
37 VALUES (101, 'RISHI', 'DATASTORE', 'Y')
38 /
39 INSERT INTO MY_MASTER
40 VALUES (102, 'BARBARA', 'TEST', 'Y')
41 /
42 INSERT INTO MY_DETAIL
43 VALUES (101, '00002', 'The direct datastore')
44 /
45 INSERT INTO MY_DETAIL
46 VALUES (102, '00003', 'Something else ... whatever')
47 /
48 COMMIT
49 /
50 EXEC ctx_ddl.sync_index ('M_DETAIL_INDEX')
51 SELECT token_text
52 FROM dr$master_detail_index$i
53 /
54 SELECT *
55 FROM my_master
56 WHERE CONTAINS (body, 'direct') > 0
57 /
58 SELECT *
59 FROM my_master
60* WHERE CONTAINS (body, 'something') > 0
SQL> start a.sql
Table dropped.
Table dropped.
PL/SQL procedure successfully completed.
Table created.
Table created.
Table altered.
PL/SQL procedure successfully completed.
Index created.
1 row created.
1 row created.
1 row created.
1 row created.
Commit complete.
PL/SQL procedure successfully completed.
TOKEN_TEXT
----------------------------------------------------------------
Y
1 row selected.
no rows selected
no rows selected
|
|
|
|
| Re: DetailDatastore [message #133372 is a reply to message #133230] |
Thu, 18 August 2005 15:05   |
 |
Barbara Boehmer
Messages: 7669 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
You have changed the name of the index in some places, but not in others. In some places, you have changed it to m_detail_index, but then you are selecting from dr$master_detail_index$i, instead of dr$m_detail_index$i, so that tells me nothing. I also cannot tell whether the script you posted is the script you ran. You need to drop everything that you have previously created, including indexes and preferences, and copy the script that I provided to a.sql, not make any chnges to it, then:
SQL> SET ECHO ON FEEDBACK ON
SQL> START a.sql
then copy and paste the results.
|
|
|
|
| Re: DetailDatastore [message #133406 is a reply to message #133372] |
Thu, 18 August 2005 23:14   |
kumarvision25
Messages: 19 Registered: August 2005 Location: a
|
Junior Member |

|
|
hi barbara,
I have dropped the index and preference and i run the script.
i cant able to create index some error is coming.
SQL> SET ECHO ON FEEDBACK ON
SQL> START a.sql
SQL> drop table my_detail
2 /
Table dropped
SQL> drop table my_master
2 /
Table dropped
SQL> CREATE TABLE MY_MASTER
2 (ARTICLE_ID NUMBER PRIMARY KEY,
3 AUTHOR VARCHAR2(30),
4 TITLE VARCHAR2(50),
5 BODY CHAR(1))
6 /
Table created.
SQL> CREATE TABLE MY_DETAIL
2 (ARTICLE_ID NUMBER,
3 SEQ NUMBER,
4 TEXT CLOB)
5 /
Table created.
SQL> ALTER TABLE MY_DETAIL
2 ADD CONSTRAINT MY_DETAIL_FK
3 FOREIGN KEY (ARTICLE_ID)
4 REFERENCES MY_MASTER (ARTICLE_ID)
5 /
Table altered.
SQL> BEGIN
2 CTX_DDL.CREATE_PREFERENCE ('MY_DETAIL_PREF', 'DETAIL_DATASTORE');
3 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'binary', 'true');
4 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_table', 'MY_DETAIL');
5 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_key', 'ARTICLE_ID');
6 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_lineno', 'SEQ');
7 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_text', 'TEXT');
8 END;
9 /
PL/SQL procedure successfully completed.
SQL> CREATE INDEX MASTER_DETAIL_INDEX
2 ON MY_MASTER (BODY)
3 INDEXTYPE IS CTXSYS.CONTEXT
4 PARAMETERS ('DATASTORE MY_DETAIL_PREF')
5 /
CREATE INDEX MASTER_DETAIL_INDEX
*
ERROR at line 1:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-06509: PL/SQL: ICD vector missing for this package
ORA-06512: at "CTXSYS.UTL_RAW", line 289
ORA-06512: at "CTXSYS.DRIPARSE", line 37
ORA-06512: at "CTXSYS.DRIPARSE", line 1384
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 22
SQL> INSERT INTO MY_MASTER
2 VALUES (101, 'RISHI', 'DATASTORE', 'Y')
3 /
INSERT INTO MY_MASTER
*
ERROR at line 1:
ORA-29861: domain index is marked LOADING/FAILED/UNUSABLE
SQL> INSERT INTO MY_MASTER
2 VALUES (102, 'BARBARA', 'TEST', 'Y')
3 /
INSERT INTO MY_MASTER
*
ERROR at line 1:
ORA-29861: domain index is marked LOADING/FAILED/UNUSABLE
SQL> INSERT INTO MY_DETAIL
2 VALUES (101, '00002', 'The direct datastore')
3 /
INSERT INTO MY_DETAIL
*
ERROR at line 1:
ORA-02291: integrity constraint (CTXSYS.MY_DETAIL_FK) violated - parent key not
found
SQL> INSERT INTO MY_DETAIL
2 VALUES (102, '00003', 'Something else ... whatever')
3 /
INSERT INTO MY_DETAIL
*
ERROR at line 1:
ORA-02291: integrity constraint (CTXSYS.MY_DETAIL_FK) violated - parent key not
found
SQL> COMMIT
2 /
Commit complete.
SQL> EXEC ctx_ddl.sync_index ('MASTER_DETAIL_INDEX')
BEGIN ctx_ddl.sync_index ('MASTER_DETAIL_INDEX'); END;
*
ERROR at line 1:
ORA-20000: Oracle Text error:
DRG-10502: index MASTER_DETAIL_INDEX does not exist
ORA-06512: at "CTXSYS.DRUE", line 157
ORA-06512: at "CTXSYS.CTX_DDL", line 1328
ORA-06512: at line 1
SQL> SELECT token_text
2 FROM dr$master_detail_index$i
3 /
TOKEN_TEXT
----------------------------------------------------------------
Y
1 row selected.
SQL> SELECT *
2 FROM my_master
3 WHERE CONTAINS (body, 'direct') > 0
4 /
no rows selected
SQL> SELECT *
2 FROM my_master
3 WHERE CONTAINS (body, 'something') > 0
4 /
no rows selected
|
|
|
|
| Re: DetailDatastore [message #133422 is a reply to message #133372] |
Fri, 19 August 2005 00:30   |
kumarvision25
Messages: 19 Registered: August 2005 Location: a
|
Junior Member |

|
|
hi barbara,
I have drop the old index and created the new index and run the script without error it is working fine but still the select query displays no rows selected
SQL> start c.sql
SQL> drop table my_detail
2 /
Table dropped.
SQL> drop table my_master
2 /
Table dropped.
SQL> CREATE TABLE MY_MASTER
2 (ARTICLE_ID NUMBER PRIMARY KEY,
3 AUTHOR VARCHAR2(30),
4 TITLE VARCHAR2(50),
5 BODY CHAR(1))
6 /
Table created.
SQL> CREATE TABLE MY_DETAIL
2 (ARTICLE_ID NUMBER,
3 SEQ NUMBER,
4 TEXT CLOB)
5 /
Table created.
SQL> ALTER TABLE MY_DETAIL
2 ADD CONSTRAINT MY_DETAIL_FK
3 FOREIGN KEY (ARTICLE_ID)
4 REFERENCES MY_MASTER (ARTICLE_ID)
5 /
Table altered.
SQL>
SQL> BEGIN
2 CTX_DDL.CREATE_PREFERENCE ('MY_DETAIL_PREF', 'DETAIL_DATASTORE');
3 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'binary', 'true');
4 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_table', 'MY_DETAIL');
5 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_key', 'ARTICLE_ID');
6 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_lineno', 'SEQ');
7 CTX_DDL.set_attribute ('MY_DETAIL_PREF', 'detail_text', 'TEXT');
8 END;
9 /
PL/SQL procedure successfully completed.
SQL> CREATE INDEX DETAIL_INDEX
2 ON MY_MASTER (BODY)
3 INDEXTYPE IS CTXSYS.CONTEXT
4 PARAMETERS ('DATASTORE MY_DETAIL_PREF')
5 /
Index created.
SQL> INSERT INTO MY_MASTER
2 VALUES (101, 'RISHI', 'DATASTORE', 'Y')
3 /
1 row created.
SQL> INSERT INTO MY_MASTER
2 VALUES (102, 'BARBARA', 'TEST', 'Y')
3 /
1 row created.
SQL> INSERT INTO MY_DETAIL
2 VALUES (101, '00002', 'The direct datastore')
3 /
1 row created.
SQL> INSERT INTO MY_DETAIL
2 VALUES (102, '00003', 'Something else ... whatever')
3 /
1 row created.
SQL> COMMIT
2 /
Commit complete.
SQL> EXEC ctx_ddl.sync_index ('DETAIL_INDEX')
PL/SQL procedure successfully completed.
SQL> SELECT token_text
2 FROM dr$DETAIL_INDEX$i
3 /
TOKEN_TEXT
----------------------------------------------------------------
Y
1 row selected.
SQL> SELECT *
2 FROM my_master
3 WHERE CONTAINS (body, 'direct') > 0
4 /
no rows selected
SQL> SELECT *
2 FROM my_master
3 WHERE CONTAINS (body, 'something') > 0
4 /
no rows selected
|
|
|
|
|
|
|
|
|
|
| Re: DetailDatastore [message #133592 is a reply to message #133479] |
Fri, 19 August 2005 18:37   |
 |
Barbara Boehmer
Messages: 7669 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
It looks like you have created some stuff in ctxsys that may be in conflict with your other stuff. Try running the commands below, then re-running the whole other script and see what happens. You may need to connect as ctxsys and run the commands below, but do not run the other script while connected as ctxsys.
drop index master_detail_index
/
drop index ctxsys.detail_idex
/
exec ctx_ddl.drop_preference ('CTXSYS.MY_DETAIL_PREF')
drop table ctxsys.my_detail
/
drop table ctxsys.my_master
/
If that doesn't help, then try connecting as ctxsys and:
GRANT ctxapp TO itpuser;
GRANT EXECUTE ON ctx_ddl TO itpuser;
then reconnect as itpuser and test the other script again.
If all that doesn't help, then I hope someone else has some ideas, because I am starting to run out of things to check for. The code runs fine on my system, so the problem is not the code. It must be due to something that is different on your system, such as different privileges or conflicts with previously created stuff. The results that you have posted show that there is an index in the ctxsys schema that should not be there and that the Y of the clob column is the only thing tokenized, rather than the items in the detail table. It looks like when you run the query, it is using that old index. So, I think that the key to getting it to work is thoroughly removing all of the previously created conflicting stuff.
|
|
|
|
|
|
Goto Forum:
Current Time: Sat May 25 10:48:07 CDT 2013
Total time taken to generate the page: 0.11643 seconds
|