oracle全文索引之datastore_4_URL_DATASTORE
全文索引可以很方便的索引儲存在INTERNET上的資訊。在資料庫中只需要儲存需要索引的文章的URL就可以了。
由於目前討論的是DATASTORE屬性,因此這個例子只索引HTML文章,對於其他需要使用FILTER屬性的文章,在以後討論。
[@more@]SQL> show user;
USER is "MYUSER"
SQL> CREATE TABLE T (ID NUMBER, DOCS VARCHAR2(1000));
Table created.
SQL> INSERT INTO T VALUES (1, 'http://yangtingkun.itpub.net/');
1 row created.
SQL> INSERT INTO T VALUES (2, 'http://www.itpub.net/');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> exec CTX_DDL.CREATE_PREFERENCE('TEST_URL', 'URL_DATASTORE');
PL/SQL procedure successfully completed.
SQL> exec ctx_ddl.set_attribute('TEST_URL','HTTP_PROXY','172.17.61.29:8002');
PL/SQL procedure successfully completed.
SQL> exec ctx_ddl.set_attribute('TEST_URL','Timeout','300');
PL/SQL procedure successfully completed.
SQL> CREATE INDEX IND_T_DOCS ON T (DOCS) INDEXTYPE IS CTXSYS.CONTEXT
2 PARAMETERS ('DATASTORE TEST_URL');
Index created.
SQL> SELECT * FROM T WHERE CONTAINS(DOCS, 'ORACLE') > 0;
no rows selected
由於公司上網需要設定代理,發現設定了proxy伺服器的IP地址和port不行,必須要指定為proxy服務的機器名和port.
如果需要代理才能連到INTERNET上,可以設定URL_DATASTORE的HTTP_PROXY等屬性。URL_DATASTORE還包含很多的屬性
Attribute Attribute Values
timeout
Specify the timeout in seconds. The valid range is 15 to 3600 seconds. The default is 30.
maxthreads
Specify the maximum number of threads that can be running simultaneously. Use a number between
1and 1024. The default is 8.
urlsize
Specify the maximum length of URL string in bytes. Use a number between 32 and 65535. The default
is 256.
maxurls
Specify maximum size of URL buffer. Use a number between 32 and 65535. The defaults is 256.
maxdocsize
Specify the maximum document size. Use a number between 256 and 2,147,483,647 bytes (2
gigabytes). The defaults is 2,000,000.
http_proxy
Specify the host name of http proxy server. Optionally specify port number with a colon in the
form hostname:port.
ftp_proxy
Specify the host name of ftp proxy server. Optionally specify port number with a colon in the
form hostname:port.
no_proxy
Specify the domain for no proxy server. Use a comma separated string of up to 16 domain names.
最後要說明的是,Oracle中僅僅儲存被索引文件的URL地址,因此,如果文件本身發生了變化,Oracle是無法知道的,也無法去同步索引,這時必須透過修改索引列也就是URL地址列的方式來通知Oracle,被索引資料已經發生了變化。
由於目前討論的是DATASTORE屬性,因此這個例子只索引HTML文章,對於其他需要使用FILTER屬性的文章,在以後討論。
[@more@]SQL> show user;
USER is "MYUSER"
SQL> CREATE TABLE T (ID NUMBER, DOCS VARCHAR2(1000));
Table created.
SQL> INSERT INTO T VALUES (1, 'http://yangtingkun.itpub.net/');
1 row created.
SQL> INSERT INTO T VALUES (2, 'http://www.itpub.net/');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> exec CTX_DDL.CREATE_PREFERENCE('TEST_URL', 'URL_DATASTORE');
PL/SQL procedure successfully completed.
SQL> exec ctx_ddl.set_attribute('TEST_URL','HTTP_PROXY','172.17.61.29:8002');
PL/SQL procedure successfully completed.
SQL> exec ctx_ddl.set_attribute('TEST_URL','Timeout','300');
PL/SQL procedure successfully completed.
SQL> CREATE INDEX IND_T_DOCS ON T (DOCS) INDEXTYPE IS CTXSYS.CONTEXT
2 PARAMETERS ('DATASTORE TEST_URL');
Index created.
SQL> SELECT * FROM T WHERE CONTAINS(DOCS, 'ORACLE') > 0;
no rows selected
由於公司上網需要設定代理,發現設定了proxy伺服器的IP地址和port不行,必須要指定為proxy服務的機器名和port.
如果需要代理才能連到INTERNET上,可以設定URL_DATASTORE的HTTP_PROXY等屬性。URL_DATASTORE還包含很多的屬性
Attribute Attribute Values
timeout
Specify the timeout in seconds. The valid range is 15 to 3600 seconds. The default is 30.
maxthreads
Specify the maximum number of threads that can be running simultaneously. Use a number between
1and 1024. The default is 8.
urlsize
Specify the maximum length of URL string in bytes. Use a number between 32 and 65535. The default
is 256.
maxurls
Specify maximum size of URL buffer. Use a number between 32 and 65535. The defaults is 256.
maxdocsize
Specify the maximum document size. Use a number between 256 and 2,147,483,647 bytes (2
gigabytes). The defaults is 2,000,000.
http_proxy
Specify the host name of http proxy server. Optionally specify port number with a colon in the
form hostname:port.
ftp_proxy
Specify the host name of ftp proxy server. Optionally specify port number with a colon in the
form hostname:port.
no_proxy
Specify the domain for no proxy server. Use a comma separated string of up to 16 domain names.
最後要說明的是,Oracle中僅僅儲存被索引文件的URL地址,因此,如果文件本身發生了變化,Oracle是無法知道的,也無法去同步索引,這時必須透過修改索引列也就是URL地址列的方式來通知Oracle,被索引資料已經發生了變化。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/271283/viewspace-1022086/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle全文索引之STORAGE PREFERENCEOracle索引
- oracle全文索引之WORDLIST PREFERENCEOracle索引
- oracle全文索引之幾個關鍵表Oracle索引
- oracle全文索引之commit與DML操作Oracle索引MIT
- oracle全文索引之如何實現查詢Oracle索引
- oracle全文索引之STOPLIST_4_MULTI_STOPLISTOracle索引
- oracle全文索引之STOPLIST_3_DEFAULT_STOPLISTOracle索引
- oracle全文索引之STOPLIST_2_EMPTY_STOPLISTOracle索引
- oracle全文索引之STOPLIST_1_BASIC_STOPLISTOracle索引
- oracle全文索引之LEXER_4_MULTI_LEXEROracle索引
- oracle全文索引之LEXER_3_DEFAULT_LEXEROracle索引
- oracle全文索引之LEXER_2_CHINESE_LEXEROracle索引
- oracle全文索引之LEXER_1_BASIC_LEXEROracle索引
- oracle全文索引之FILTER_4_PROCEDURE_FILTEROracle索引Filter
- oracle全文索引之FILTER_3_FORMAT_COLUMNOracle索引FilterORM
- oracle全文索引之FILTER_1_NULL_FILTEROracle索引FilterNull
- oracle全文索引之datastore_6_NESTED_DATASTOREOracle索引AST
- oracle全文索引之datastore_5_detail_datastoreOracle索引ASTAI
- oracle全文索引之datastore_3_FILE_DATASTOREOracle索引AST
- oracle全文索引之datastore_1_DIRECT_DATASTOREOracle索引AST
- Oracle:全文索引Oracle索引
- oracle全文索引之配置全文檢索環境Oracle索引
- oracle 之全文索引表的分割槽交換案例Oracle索引
- oracle全文索引之About_INDEX_THEMES操作Oracle索引Index
- oracle全文索引之STOPLIST_ CTXCAT 索引_INDEX SETOracle索引Index
- oracle全文索引之datastore_2_MULTI_COLUMN_DATASTOREOracle索引AST
- Oracle的全文索引Oracle索引
- ZT oracle全文索引Oracle索引
- oracle全文索引之SECTION GROUP_6_PATH_SECTION_GROUPOracle索引
- oracle全文索引之SECTION GROUP_5_AUTO_SECTION_GROUPOracle索引
- oracle全文索引之SECTION GROUP_4_XML_SECTION_GROUPOracle索引XML
- oracle全文索引之SECTION GROUP_3_HTML_SECTION_GROUPOracle索引HTML
- oracle全文索引之SECTION GROUP_2_BASIC_SECTION_GROUPOracle索引
- oracle全文索引之SECTION GROUP_1_NULL_SECTION_GROUPOracle索引Null
- oracle全文索引之FILTER_2_INSO_FILTEROracle索引Filter
- oracle 全文索引的配置Oracle索引
- MongoDB之索引(全文索引)MongoDB索引
- oracle全文索引之同步和優化索引做了什麼Oracle索引優化