Research on full-text retrieval of Oracle (full 6)

Source: Internet
Author: User

3.6 Wordlist attributes

The wordlist attribute of Oracle full-text search is used to set fuzzy queries and root queries. The wordlist attribute also supports

For subqueries and prefix queries, the oracle wordlist attribute is only basic_wordlist (Original: Use the wordlist

Preference to enable the query options such as stemming, fuzzy matching for your language. You

Can also use the wordlist preference to enable substring and prefix indexing, which improves

Performance for wildcard queries with CONTAINS and CATSEARCH .)

3.6.1 example:

Create table my_word (id number, docs varchar2 (1000 ));

Insert into my_word values (1, Specify the stemmer used for word stemming in Text queries );

Insert into my_word values (2, Specify which fuzzy matching routines are used for

Column );

Insert into my_word values (3, Fuzzy matching is currently supported for English );

Insert into my_word values (4, Specify a default lower limit of fuzzy score. Specify

Number between 0 and 80 );

Insert into my_word values (5, Specify TRUE for Oracle Text to create a substring index

Matched .);

Commit;

/

-- Create a wordlist

Begin

Ctx_ddl.drop_preference (mywordlist );

Ctx_ddl.create_preference (mywordlist, basic_wordlist );

Ctx_ddl.set_attribute (mywordlist, fuzzy_match, english); -- fuzzy match, english

Ctx_ddl.set_attribute (mywordlist, fuzzy_score, 0); -- match score

Ctx_ddl.set_attribute (mywordlist, fuzzy_numresults, 5000 );

Ctx_ddl.set_attribute (mywordlist, substring_index, true); -- left query, applicable to % to, % to %

Ctx_ddl.set_attribute (mywordlist, stemmer, english); -- root

Ctx_ddl.set_attribute (mywordlist, prefix_index, true); -- right query, t0 %

End;

Create index indx_m_word on my_word (docs) indextype is ctxsys. context

Parameters (wordlist mywordlist );

-- Example

Select docs from my_word where contains (docs, $ match)> 0; -- Root Query

Select docs from my_word where contains (docs, MA %)> 0; -- match Query

 

3.6.2 example on document

Create table quick (quick_id number primary key, text varchar (80 ));

--- Insert a row with 10 expansions for tire %

Insert into quick (quick_id, text)

Values (1, tire tirea tireb tirec tired tiree tiref tireg tireh tirei tirej );

Commit;

/

Begin

Ctx_Ddl.Create_Preference (wildcard_pref, BASIC_WORDLIST );

Ctx_ddl.set_attribute (wildcard_pref, wildcard_maxterms, 100 );

End;

/

Create index wildcard_idx on quick (text) indextype is ctxsys. context

Parameters (Wordlist wildcard_pref );

Select quick_id from quick where contains (text, tire %)> 0;

Drop index wildcard_idx;

Begin

Ctx_Ddl.Drop_Preference (wildcard_pref );

Ctx_Ddl.Create_Preference (wildcard_pref, BASIC_WORDLIST );

Ctx_ddl.set_attribute (wildcard_pref, wildcard_maxterms, 5); -- limit the maximum number of matches, as shown in figure

If this quantity is exceeded, an error is returned during the query.

End;

/

Create index wildcard_idx on quick (text) indextype is ctxsys. context

Parameters (Wordlist wildcard_pref );

Select quick_id from quick where contains (text, tire %)> 0;

 

3.6.3. Reference script

-- Create a wordlist

Begin

Ctx_ddl.create_preference (mywordlist, BASIC_WORDLIST );

Ctx_ddl.set_attribute (mywordlist, PREFIX_INDEX, TRUE); -- Define the wordlist Parameter

End;

-- Delete wordlist

Begin

Ctx_ddl.drop_preference (mywordlist );

 

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.