Example of how to create an oracle full-text index

Source: Internet
Author: User
Tags lexer
The database must first have the ctxsys user and ctxapp role
Database users assign ctxapp roles
Make sure that the LSNRCTL is running on the Oracle server. The plsextproc service is started.

Create Table tbl_1 (ID int primary key, title varchar2 (2000), cont BLOB );
Insert N records
Begin
Ctx_ddl.create_preference ('My _ lexer ', 'Chinese _ vgram_lexer ');
End;
Create index qidx_tbl_1_1 on tbl_1 (title) indextype is ctxsys. context parameters ('lexer my_lexer ')
Create index qidx_tbl_1_2 on tbl_1 (cont) indextype is ctxsys. context parameters ('lexer my_lexer ')

Search
Select * From tbl_1 where contains (title, 'search content')> 0;
Select * From tbl_1 where contains (cont, 'Find content')> 0;

Synchronization
Exec ctx_ddl.sync_index ('qidx _ tbl_1_1 ');
Exec ctx_ddl.sync_index ('qidx _ tbl_1_2 ');

Defects

We recommend that you do not use or to associate two full-text indexes. Otherwise, the efficiency is very low.
The search content can only match words manually created by the lexical analyzer.
For example, you can search for the title, but cannot find t.
Think about it too. Otherwise, the efficiency will not be too low. Haha

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.