Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Create a Robust Document Management System with Oracle Text : Page 5

Oracle Text has a powerful text-search engine that allows users to search and manage documents and URLs as quickly and easily as any other data. Learn to use these features to deliver a robust content management search engine.


advertisement
Step 4: Performing Queries
To prove your indexes were created properly and to demonstrate a number of ways for querying your content management repository, run through a number of test cases:

SQL> --for readability SQL> SET LINESIZE 5000 SQL> SET PAGESIZE 5000

The following simple example demonstrates returning documents (not URLs) that match one specific word. In this case, you are searching for the word "oracle" in any of your documents:



SQL> select content_inventory_id, file_name from CMDEMO.content_inventory where contains(text,'oracle') > 0; CONTENT_INVENTORY_ID FILE_NAME -------------------- -------------- 3 OO4O_ORA.XLS 2 Readme.doc 1 install.pdf

For the sake of brevity, I left off the returned result sets for the following queries. The purpose here is to show queries for some scenarios you likely will encounter:

  1. This example returns URLs (not documents) that match one specific word:

    SQL> select content_inventory_id, url from CMDEMO.content_inventory where contains(url,'&WORD_TO_FIND') > 0;

  2. This example returns documents or URLs that match ANY one of your words. In this case, you are looking for documents and URLs that contain the word "sales" or "oracle":

    SQL> select content_inventory_id, decode(file_name,null,url,file_name) Location from CMDEMO.content_inventory where contains(text,'sales OR oracle') > 0 or contains(url,'sales OR oracle') > 0;

  3. This example returns documents or URLs that match ALL of your words. In this case, you are looking for documents and URLs that contain the word "sales" and "oracle":

    SQL> select content_inventory_id, file_name from CMDEMO.content_inventory where contains(text,'sales AND oracle') > 0 or contains(url,'sales AND oracle') > 0;

  4. This example returns documents that contain the word "oracle" but not the word "cluster":

    select content_inventory_id, file_name from CMDEMO.content_inventory where contains(text,'oracle') > 0 and contains(text,'cluster') = 0

As mentioned earlier, your business users also want the flexibility to enter keywords that are not part of the actual document or Web site being indexed. For this reason, you created the KEYWORDS field in your CONTENT_INVENTORY table. When you inserted your records into this source table, you gave one of the records a value in the KEYWORDS column. None of your source documents or URLs has the word "encompassing" in them. To return documents or URLs that match this specific keyword, use the following routine:

SQL> select content_inventory_id, decode(file_name,null,url,file_name) Location from CMDEMO.content_inventory where contains(text,'encompassing') > 0 or contains(url,'encompassing') > 0 or upper(keywords) like '%ENCOMPASSING%';



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date