• Oracle全文检索学习(一)


    操作系统:windows xp
    Oracle 10g  10.2
    内存:512M
    数据库全装: 必须要用CTXSYS用户.
    以下是建立最简单支持英文的全文检索
    --删除text用户
    Drop User text;

    -- 创建text用户
    create user text
      identified by text
      default tablespace USERS
      temporary tablespace TEMP;
    -- Grant/Revoke role privileges
    grant resource to text with admin option;
    grant connect to text with admin option;


    --将CTXAPP用户的权限赋予TEXT用,
    Grant CTXAPP  to  text  with  Admin  Option;


    --将HR用户下的EMPLOREE表和数据拷贝到text用户下
     
    --建立一个preference:( ----设置搜索器类型) 
    BEGIN
    ctx_ddl.create_preference ('main_lexer', 'chinese_lexer');
    ctx_ddl.create_preference('mywordlist', 'BASIC_WORDLIST');
    ctx_ddl.set_attribute('mywordlist','PREFIX_INDEX','TRUE');
    ctx_ddl.set_attribute('mywordlist','PREFIX_MIN_LENGTH',1);
    ctx_ddl.set_attribute('mywordlist','PREFIX_MAX_LENGTH', 5);
    ctx_ddl.set_attribute('mywordlist','SUBSTRING_INDEX', 'YES');

    END;


    --释放preference
    BEGIN
    ctx_ddl.drop_preference ('main_lexer');
    ctx_ddl.drop_preference ('mywordlist');
    END;

    --浏览自己创造的preference
    SELECT * FROM ctx_user_preferences ;

    --创建索引
    Drop Index myindex;

    --如果不显示的指定索引参数,系统会自动探测文本语言,数据类型和文档格式
    CREATE INDEX myindex ON EMPLOREE(first_name) INDEXTYPE IS CTXSYS.Context;


    /*如上命令建立了一个默认参数的CONTEXT索引myindex.系统默认:
    1. 文本存储在数据库中。可以是CLOB, BLOB, BFILE, VARCHAR2, or CHAR类型的文本数据。
    2. 文本列语言是数据库建立时的默认的字符集。
    3. 使用数据库默认的终止目录stoplist.stoplist记录存在于文本列中但不对其索引的词。
    4. 允许模糊查询。模糊查询阐述用%表示*/

    select * from EMPLOREE where contains(first_name,'D%A%') >0;

  • 相关阅读:
    【SQLSERVER学习笔记】进攻式编程
    jQuery插件开发全解析
    淘宝前端框架kissyui
    JS获取MVC Attrbuate验证是否通用
    Asp.net MVC 自定义错误页面以及return HttpNotFound遇到的问题
    为类型“xxxx”多次调用了 Map,且其中至少有一个调用未指定目标表名称。
    Entity FreamWork 无法创建“System.Object”类型的常量值。此上下文仅支持基元类型或枚举类型错误解决
    Scala集合
    Scala面向对象
    scala函数
  • 原文地址:https://www.cnblogs.com/bobzhangfw/p/768112.html
Copyright © 2020-2023  润新知