Home » Server Options » Text & interMedia » USER_DATASTORE procedure and markup
USER_DATASTORE procedure and markup [message #606646] Mon, 27 January 2014 22:24
referee
Messages: 1
Registered: January 2014
Junior Member
Hello
Oracle 11.2
I create USER_DATASTORE like:

CREATE OR REPLACE PROCEDURE prc_fs_file_idx (p_rowid IN ROWID, p_clob IN OUT NOCOPY CLOB)
AS
  v_clob CLOB;
BEGIN
  FOR r IN (SELECT mt.id, tt.data
    FROM fs_file mt, fs_file_space_1 tt
    WHERE mt.id = tt.id AND mt.ROWID = p_rowid)
  LOOP
    DBMS_LOB.CREATETEMPORARY (v_clob, TRUE);
    CTX_DOC.IFILTER (r.data, v_clob);
    DBMS_LOB.WRITEAPPEND (p_clob, 6, '<body>');
    DBMS_OUTPUT.PUT_LINE(sysdate);
    DBMS_LOB.APPEND (p_clob, v_clob);
    DBMS_LOB.WRITEAPPEND (p_clob, 7, '</body>');
    DBMS_LOB.FREETEMPORARY (v_clob);
  END LOOP;
END prc_fs_file_idx;
/

BEGIN
  CTX_DDL.CREATE_PREFERENCE ('test_datastore', 'USER_DATASTORE');
  CTX_DDL.SET_ATTRIBUTE ('test_datastore', 'PROCEDURE', 'prc_fs_file_idx');
  CTX_DDL.SET_ATTRIBUTE ('test_datastore', 'OUTPUT_TYPE', 'CLOB');
END;
/
CREATE INDEX fs_file_dummy_idx
ON fs_file (dummy)
INDEXTYPE IS CTXSYS.CONTEXT
PARAMETERS ('DATASTORE test_datastore')
/


Documentation says:
Quote:
The stored procedure is called once for each row indexed. Given the rowid of the current row, procedure must write the text of the document into its second argument, whose type you specify with output_type.

This is true for CONTAINS(...)
But then i call ctx_doc.markup he always call procedure PRC_FS_FILE_IDX (i noticed this with DBMS_OUTPUT.PUT_LINE(sysdate); ), why he don't cache the result of PRC_FS_FILE_IDX?

declare 
  mklob clob;
begin
  ctx_doc.markup (index_name   => 'FS_FILE_DUMMY_IDX',
                  textkey      => '9886',--rowid
                  text_query   => 'ромашка',
                  restab       => mklob);
end;


Sorry for my english Smile
Thanks alot

[Updated on: Mon, 27 January 2014 22:42]

Report message to a moderator

Previous Topic: Oracle text related internal procedure taking a lot of time in our Prod. database
Next Topic: Word category and word relation
Goto Forum:
  


Current Time: Fri Dec 27 00:07:04 CST 2024