• oracle全文检索笔记


    1、删除词法解析器

    exec ctx_ddl.drop_preference('my_lexer');

    2、创建中文词法解析器

    exec ctx_ddl.create_preference ('my_lexer', 'chinese_vgram_lexer');

    3、创建全文索引,多字段

    EXEC ctx_ddl.create_preference('ctx_idx_jdw_person_pref','MULTI_COLUMN_DATASTORE');

    EXEC ctx_ddl.set_attribute('ctx_idx_jdw_person_pref ','columns','name,address');

    CREATE INDEX ctx_idx_jdw_person ON jdw_person(name) INDEXTYPE IS ctxsys.CONTEXT PARAMETERS('DATASTORE ctx_idx_jdw_person_pref lexer my_lexer');

    4、切词

    exec CTX_DDL.CREATE_POLICY('MY_POLICY', LEXER => 'my_lexer'); 

    create or replace function p_split_chinese(p_input in varchar2)
    return varchar2 as
    v_tab CTX_DOC.TOKEN_TAB;
    v_return VARCHAR2(323767);
    begin
    CTX_DOC.POLICY_TOKENS('my_policy',p_input,v_tab);
    for i in 1..v_tab.count loop
    v_return := v_return || ',' || v_tab(i).token;
    end loop;
    return LTRIM(v_return,',');
    end;
    /

    5、同步及优化

    exec ctx_ddl.sync_index('ctx_idx_jdw_person');

    exec ctx_ddl.optimize_index('ctx_idx_jdw_person', 'full');

    6、创建定时任务,定期优化和同步域索引

    SQL> create or replace procedure hsp_sync_index as
    2 begin
    3 ctx_ddl.sync_index('id_cont_msg');
    4 end;
    5 /

    Procedure created.

    Elapsed: 00:00:00.08
    SQL> VARIABLE jobno number;
    SQL> BEGIN
    2 DBMS_JOB.SUBMIT(:jobno,'hsp_sync_index();',
    3 SYSDATE, 'SYSDATE + (1/24/4)');
    4 commit;
    5 END;
    6 /

    PL/SQL procedure successfully completed.

    Elapsed: 00:00:00.27
    SQL> create or replace procedure hsp_optimize_index as
    2 begin
    3 ctx_ddl.optimize_index('id_cont_msg','FULL');
    4 end;
    5 /

    SQL> VARIABLE jobno number;
    SQL> BEGIN
    2 DBMS_JOB.SUBMIT(:jobno,'hsp_optimize_index();',
    3 SYSDATE, 'SYSDATE + 1');
    4 commit;
    5 END;
    6 /
    Procedure created.

    Elapsed: 00:00:00.03

    PL/SQL procedure successfully completed.

    Elapsed: 00:00:00.02
    SQL>

  • 相关阅读:
    golang pprof 使用
    iostat相关参数说明——await:平均每次设备I/O操作的等待时间 (毫秒),如果%util接近 100%,说明产生的I/O请求太多...
    二分查找
    golang 切片copy复制和等号复制的区别
    维生素
    LinkedBlockingQueue
    ArrayBlockingQueue
    wordpress文章点击次数统计插件WP Postviews 使用方法
    windows7下cmd窗口使用ssh登录服务器(云、本地)
    WinISO Standard V6.4.1.6137 免费无限制版
  • 原文地址:https://www.cnblogs.com/sdnu/p/5554115.html
Copyright © 2020-2023  润新知