Oracle全文檢索之Ctxcat 索引
今天測試了Ctxcat 索引,發現也不支援中文分詞。
SQL> Create table auction(Item_id number,Title varchar2(100),Category_id number,Price number,Bid_close date);
Table created
SQL> Insert into auction values(1, 'nikon camera', 1, 400, to_date('24-10-2002','dd-mm-yyyy'));
1 row inserted
SQL> Insert into auction values(2, 'olympus camera', 1, 300, to_date('25-10-2002','dd-mm-yyyy'));
1 row inserted
SQL> Insert into auction values(3, 'pentax camera', 1, 200, to_date('26-10-2002','dd-mm-yyyy'));
1 row inserted
SQL> Insert into auction values(4, 'canon camera', 1, 250, to_date('27-10-2002','dd-mm-yyyy'));
1 row inserted
SQL> Commit;
Commit complete
--建立索引集
SQL> begin
2 ctx_ddl.create_index_set('auction_iset');
3 ctx_ddl.add_index('auction_iset','price'); /* sub-index a*/
4 end;
5 /
PL/SQL procedure successfully completed
--建立索引
SQL> Create index auction_titlex on auction(title) indextype is ctxsys.ctxcat parameters ('index set auction_iset');
Index created
SQL> Column title format a60;
SQL> Select title, price from auction where catsearch(title, 'camera', 'order by price')> 0;
TITLE PRICE
------------------------------------------------------------ ----------
pentax camera 200
canon camera 250
olympus camera 300
nikon camera 400
--測試索引是否自動同步
SQL> Insert into auction values(5, 'aigo camera', 1, 10, to_date('27-10-2002','dd-mm-yyyy'));
1 row inserted
SQL> Insert into auction values(6, 'len camera', 1, 23, to_date('27-10-2002','dd-mm-yyyy'));
1 row inserted
SQL> commit;
Commit complete
SQL> Select title, price from auction where catsearch(title, 'camera','price <= 100')>0;
TITLE PRICE
------------------------------------------------------------ ----------
aigo camera 10
len camera 23
SQL> --新增多個子查詢到索引集:
SQL> begin
2 ctx_ddl.drop_index_set('auction_iset');
3 ctx_ddl.create_index_set('auction_iset');
4 ctx_ddl.add_index('auction_iset','price'); /* sub-index A */
5 ctx_ddl.add_index('auction_iset','price, bid_close'); /* sub-index B */
6 end;
7 /
PL/SQL procedure successfully completed
SQL> drop index auction_titlex;
Index dropped
SQL> Create index auction_titlex on auction(title) indextype is ctxsys.ctxcat parameters ('index set auction_iset');
Index created
SQL> SELECT * FROM auction WHERE CATSEARCH(title, 'camera','price = 200 order by bid_close')>0;
ITEM_ID TITLE CATEGORY_ID PRICE BID_CLOSE
---------- ------------------------------------------------------------ ----------- ---------- -----------
3 pentax camera 1 200 2002/10/26
SQL> SELECT * FROM auction WHERE CATSEARCH(title, 'camera','order by price, bid_close')> 0;
ITEM_ID TITLE CATEGORY_ID PRICE BID_CLOSE
---------- ------------------------------------------------------------ ----------- ---------- -----------
5 aigo camera 1 10 2002/10/27
6 len camera 1 23 2002/10/27
3 pentax camera 1 200 2002/10/26
4 canon camera 1 250 2002/10/27
2 olympus camera 1 300 2002/10/25
1 nikon camera 1 400 2002/10/24
6 rows selected
SQL>
SQL> --測試中文支援
SQL> Insert into auction values(15, '佳能照相機', 1, 3700, to_date('27-10-2002','dd-mm-yyyy'));
1 row inserted
SQL> Insert into auction values(16, '海爾洗衣機', 1, 2300, to_date('27-10-2002','dd-mm-yyyy'));
1 row inserted
SQL> commit;
Commit complete
SQL> SELECT * FROM auction WHERE CATSEARCH(title, '照相機','order by price, bid_close')> 0;
ITEM_ID TITLE CATEGORY_ID PRICE BID_CLOSE
---------- ------------------------------------------------------------ ----------- ---------- -----------
SQL> Select title, price from auction ;
TITLE PRICE
------------------------------------------------------------ ----------
nikon camera 400
olympus camera 300
pentax camera 200
canon camera 250
aigo camera 10
len camera 23
佳能照相機 3700
海爾洗衣機 2300
8 rows selected
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/81227/viewspace-692471/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle全文索引之STOPLIST_ CTXCAT 索引_INDEX SETOracle索引Index
- oracle全文索引之配置全文檢索環境Oracle索引
- Oracle全文檢索之ContextOracleContext
- Oracle全文檢索Oracle
- Oracle全文檢索之中文Oracle
- Oracle的全文檢索技術(轉)Oracle
- 手工建立oracle text全文檢索元件Oracle元件
- 全文檢索庫 bluge
- Kibana 全文檢索操作
- solr全文檢索學習Solr
- oracle全文索引之STORAGE PREFERENCEOracle索引
- oracle全文索引之WORDLIST PREFERENCEOracle索引
- 基於ElasticSearch實現商品的全文檢索檢索Elasticsearch
- elasticsearch的實現全文檢索Elasticsearch
- 請問全文檢索的思路?
- 【Oracle】-【ROWNUM與索引】-索引對ROWNUM檢索的影響Oracle索引
- Oracle:全文索引Oracle索引
- MongoDB之索引(全文索引)MongoDB索引
- php + MongoDB + Sphinx 實現全文檢索PHPMongoDB
- 全文檢索技術lucene的demo
- 全文檢索的基本原理
- PostgreSQL全文檢索-詞頻統計SQL
- coreseek,php,mysql全文檢索部署(一)PHPMySql
- coreseek,php,mysql全文檢索部署(二)PHPMySql
- openGauss每日一練(全文檢索)
- Oracle的全文索引Oracle索引
- ZT oracle全文索引Oracle索引
- 基於Lucene的全文檢索實踐
- ElasticSearch 實現分詞全文檢索 - 概述Elasticsearch分詞
- 全文字檢索的應用(2)(轉)
- 全文字檢索的應用(1)(轉)
- oracle全文索引之同步和優化索引做了什麼Oracle索引優化
- oracle全文索引之幾個關鍵表Oracle索引
- oracle全文索引之commit與DML操作Oracle索引MIT
- oracle全文索引之如何實現查詢Oracle索引
- oracle全文索引之STOPLIST_4_MULTI_STOPLISTOracle索引
- oracle全文索引之STOPLIST_3_DEFAULT_STOPLISTOracle索引
- oracle全文索引之STOPLIST_2_EMPTY_STOPLISTOracle索引