1 Reply Latest reply: Nov 16, 2012 6:40 AM by amin_adatia RSS

    How to notify user that document was indexed successfully

    Anne-Marie Rosa

      in our web application users can upload documents, which will be indexed by a sync job. The uploaded document names are displayed on a web page and now we would like to display next to the name a second column, which informs the user, whether the document is successfully indexed or not.
      I know, that I can find the document's rowid in ctx_user_pending, ctx_user_index_errors and after successful indexing in the..$K tables.
      The problem is that our index is a partitioned index and the names of the $K tables are not related to the names of the underlying partitions. The names seem to be serially numbered from 0001$K to 9999$K, but I do not knows if that will be the case in all installations. After all, what happens when there are more than 9999 partitions, in 11g it could be up to 1,048,575? Or Oracle might change the naming conventions in a future release.
      So it might not be a good idea to use the $K table to find out, if a document was indexed successfully.

      Any hints are welcome
        • 1. Re: How to notify user that document was indexed successfully
          We also have partitions. Something I do to find the number of tokens for a document
          Step 1
          FOR C1 in
           ,'DR#'||t1.ixp_index_name||lpad(t1.ixp_id,4,0)||'$I'  TOKEN_TABLE
          ,'DR#'||t1.ixp_index_name||lpad(t1.ixp_id,4,0)||'$K'  DOCUMENT_TABLE
          FROM ctx_user_index_partitions t1
          WHERE t1.ixp_index_name = p_Index
          AND     t1.IXP_PATITION_NAME = <partition_identifier>  --- we have partitions by day and have the date embedded in the name
          ORDER BY t1.ixp_table_partition_name
           v_query := 'select /+* parallel (a 4) */ count(*) from '||C1.TOKEN_TABLE||' a';
           execute immediate v_query into v_Tokens;
           IF v_Tokens != 0 THEN <there is something indexed> and I list the documents