我通过java已将Word文件的全部数据
存入Oracle的Bolb
列中,读库、编辑、存库均已成功。
问题是:如何对Blob列中的二进制格式的Word文件
进行全文检索?
经研究,需配置Oracle的InterMedia。配置后,
能够正确运行下列SQL查询语句:
Select * From 表名 Where Contains(BLOB列名, '要查找的关键词') > 0;
该语句正确执行并返回:未选定行(已确认BLOB列中确有要查找的关键词)。
问题出在那里?望高手给与指点

解决方案 »

  1.   

    楼上的,那只能把文件放外部检索吗?
    intermedia帮助不是说可以对blob字段进行全文检索吗?
      

  2.   

    会不会是你的INDEX 有问题,需要rebuild online?
      

  3.   

    全文检索的index 需要定时刷新的,否则最近的新记录就不会被检索到.
    如:
    1.
    create table proposal 
    (proposal_id number(10) primary key,
     recipient_name varchar2(25),
     proposal_name varchar2(25),
     short_description varchar2(1000),
     proposal_text CLOB,
     Budget BLOB,
     cover_letter BFILE)
     storage  (initial 50K next 50K pctincrease 0)
     tablespace lobuser
     lob (proposal_text,Budget) store as 
     (tablespace loblob storage (initial 50K next 50K pctincrease 0)
      chunk 16k pctversion 10 nocache logging);  2.
    insert into PROPOSAL
    values (1,'DOT PHILLIPS','CLEAR PHILLIPS FIELD',NULL,'This
    is the NEW text of proposal to clear Phillips field.',EMPTY_BLOB(),NULL);
    commit;3.
    CREATE INDEX INDX1 ON PROPOSAL_A(PROPOSAL_TEXT) INDEXTYPE IS ctxsys.context;4.
    SELECT * FROM PROPOSAL_A WHERE CONTAINS (PROPOSAL_TEXT, 'NEW') > 0;
    1 row returns5. Add one more row
    insert into PROPOSAL_A
    values (100,'DOT PHILLIPS','CLEAR PHILLIPS FIELD',NULL,'CLOB VALUE NEW',EMPTY_BLOB(),NULL);
    commit;6. query againSELECT * FROM PROPOSAL_A WHERE CONTAINS (PROPOSAL_TEXT, 'NEW') > 0;
    1 row returns (the new row is not fetched even the condition is matching)7. Rebuild indexexec ctxsys.ctx_ddl.sync_index('INDX1');8. query again SELECT * FROM PROPOSAL_A WHERE CONTAINS (PROPOSAL_TEXT, 'NEW') > 0;
    2 row returns (the new row is not fetched even the condition is matching)
      

  4.   

    我全文检索的过程如下:
     
    CREATE TABLE ZLMC (
    mlxh VARCHAR2(8) NOT NULL --目录序号
    ml VARCHAR2(80)         --目录名称
    nr BLOB                   --目录内容
    PRIMARY KEY (mlxh)
    );begin ctx_ddl.create_preference('my_lexer','chinese_vgram_lexer'); end;
    /
    create index index_nr on zlmlnr(nr) indextype is ctxsys.context
    parameters('filter my_filter lexer my_lexer')
    /
    select mlxh from zlmlnr where contains(nr,'中国',1)>0; 结果搜不出一条记录!