Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to Oracle Text

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Oracle Text provides indexing, word and topic search, and viewing functions for text in query applications and document classification applications. To design an Oracle Text application, first determine the type of query you expect to run. Once you know the type, you can choose the most appropriate index for the task. Oracle Text is used for the following categories of applications: Document Collection ApplicationsCatalog Information ApplicationsDocument Classification ApplicationsXML Search Applications1. Document collection application text query application enables users to search for document collections, such as websites, digital libraries, or document repositories. 1.1 apply a collection to a document collection that is usually static and the content does not change significantly after the initial index runs. The document can be of any size and format, such as HTML,PDF or Microsoft Word. These documents are stored in document tables. Enable search by first establishing an index for the document collection. Queries usually consist of words or phrases. Application users use operators such as OR and AND to specify logical combinations of words and phrases. Users can apply other query operations to improve search results, such as stemming, proximity searches, and wildcards. For this type of application, you should retrieve the document that is most relevant to the query. The document must be high in the results list. Queries are best used with CONTEXT indexes on document tables. To query the index, the application uses the SQL CONTAINS operator in the WHERE clause of the SELECT statement.

1.2 text query applications typical text query applications on the document collection of flowcharts enable users to enter queries. The application enters a CONTAINS query and returns a list of documents (called hit lists) that meet the query criteria. The results are usually ranked by correlation. The application enables users to view one or more documents in the hit list. For example, an application might index the URL (HTML file) on Web and provide query capabilities throughout the index URL. The hit list returned by the query application consists of the URL that the user can access.

The following figure shows the flowchart of a user's interaction with a simple text query application:

1) user input query 2) the application runs CONTAINS query 3) the application will display a hit list 4) the user selects a document from the hit list

5) the application presents the document to the user for viewing

two。 Catalog information application catalog information consists of inventory type information, such as an online bookstore or an auction site.

2.1 about directory information applications

The stored catalog information consists of text information (such as book title) and related structured information (such as price). Information is usually updated regularly to keep online catalogs and inventory up-to-date. A query is usually a combination of text components and structured components. The results are almost always sorted by structured components, such as date or price. Good response time is always an important factor in such query applications. CTXCAT indexes can best serve Catalog applications. Use the CATSEARCH operator to query this index in the WHERE clause of the SELECT statement.

2.2 Directory query application flowchart directory application enables users to search for specific items in the directory. For example, an online store application enables users to search for and buy items in stock. Typically, a user query consists of a text component that searches in a text description and some other ordering criteria, such as price or date. The following figure illustrates the flow chart of the directory query application for an online e-store:

1) the user enters a query consisting of a text component (such as a CD player) and a structured component (such as ordering at a price). 2) the application executes CATSEARCH queries. 3) the application displays the corresponding sorting results. 4) users browse the results. 5) the user enters another query or performs an operation, such as buying goods. 3. Document classification application in a document classification application, an input stream or set of documents is compared with a set of predefined rules. If the document conforms to one or more rules, the application performs an action. For example, suppose a news story comes in. Define a rule to represent the Finance category. This rule is essentially one or more queries used to select documents on financial topics. The rule may take the form of "stocks or bonds or returns". When the document reaches the Wall Street revenue forecast and meets the rules of that category, the application takes steps, such as marking the document as financial or sending e-mail to one or more users. To create a document classification application, create a rules table, and then create an CTXRULE index. To classify the incoming text stream, use the MATCHES operator in the WHERE clause of the SELECT statement.

The 4.XML search application the XML search application performs a search on the XML document. A regular document search usually searches a set of documents to return documents that satisfy text predicates. XML searches usually use the structure of XML documents to restrict searches. Typically, only the portion of the document that meets the search criteria is returned. For example, a user might only need a comment field for a purchase order that contains power, rather than finding all purchase orders that contain the word "power."

4.1 CONTAINS operator with XML search application

The CONTAINS operator is ideal for structured searches, and you can use the WITHIN,HASPATH and INPATH operators to perform restricted searches. If you use CONTEXT indexing, you can also benefit from the following features of Oracle Text search: token-based space-based standardized search hit list case-sensitive search chapter search language features, such as stemming and fuzzy search performance optimization queries for large document sets Note: remove the DBMS_XDBT package if you manually uninstall Oracle Text. If you install Oracle Text manually, create a DBMS_XDBT package. Starting with Oracle Database 12c, Oracle XML Database (XML DB) is automatically installed when new Oracle database software is installed or upgraded.

4.2 combine Oracle text functionality with Oracle XML DB (XML Search Index)

When you want to do a full-text search of your application, use the functions of Oracle Text and Oracle XML DB together to create an XML search index. In this case, the XML structure is exploited by entering a query such as "find all nodes that contain the word Pentium." Oracle Database 12c extends Oracle's support for the W3C XQuery specification by adding support for XQuery full-text extensions. With this support, full-text searches that support XML can be performed on XML content stored in the database.

4.2.1 use the xml_enable method to obtain XML Search Index

XML Search Index is an XML-enabled Oracle text index (CTXSYS.CONTEXT). This index type supports information retrieval search and structured search in a unified index. XML Search Index also stores the binary persistent document object Model (PDOM) internally in the Oracle text table, so that XML operations can be functionally evaluated on binary PDOM. The XMLTYPE data store supports this XML search index. In the case of such an XML search index, XMLEXISTS is seamlessly rewritten as a CONTAINS query. When you create a XML Search Index, you implement the Binary PDOM of the XML document in the Oracle Text internal table. Post-evaluation from the Oracle Text index is redirected to run counter to the PDOM stored in this internal table.

Create XML Search Index:exec CTX_DDL.CREATE_SECTION_GROUP ('secgroup','PATH_SECTION_GROUP'); exec CTX_DDL.SET_SEC_GRP_ATTR (' secgroup','xml_enable','t'); CREATE INDEX po_ctx_idx on T (X) indextype is ctxsys.context parameters ('section group SECGROUP'); 4.2.2 using the Text-on-XML method using Oracle Text, you can create an CONTEXT index on a column that contains XML data. The column type can be XMLType or any supported type, as long as you use the correct index preference for XML data. Using the text method on XML, use standard CONTAINS queries and add structural constraints to limit the search to specific parts, fields, tags, or attributes. That is, specify the structure inside the text operator, such as WITHIN,HASPATH and INPATH. For example, the CONTEXT index is set to create chapters using XML documents. Consider the following XML document that defines purchase order: Po_1 John 1033 Main Street Sunnyvalue CA Dell Computer Pentium 2.0 Ghz 500MB RAM Norelco R100 Electric Razor-to query all purchase order containing Pentium in the ITEM description section, use the WITHIN operator: SELECT id from po_tab where CONTAINS (doc, 'Pentium WITHIN DESC') > 0 Using the INPATH operator, you can use XPATH expressions to specify more complex conditions: SELECT id from po_tab where CONTAINS (doc, 'Pentium INPATH (/ PURCHASEORDER/ITEMS/ITEM/DESC') > 0

4.2.3 indexing JSON data

JavaScript Object Notation (JSON) is a language-independent data format used to serialize structured data and exchange it over the network, usually between the server and the Web application. JSON provides a text-based way to represent JavaScript object text, arrays, and scalar data. Create table T1 (txn_date date, po CLOB, constraint C1 check (po is json)); create search index idx on T1 (po) for JSON parameters ('DATAGUIDE ON sync (on commit)')

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report