Level: Intermediate Michael S. Schwartz (miss@us.ibm.com), Senior Software Engineer, IBM
12 Jan 2006 Increase search precision and performance in DB2® Content Manager by searching only a specific text-searchable part of an item with more than one part. This article shows you how to search without employing a heuristic approach to solving a problem, and shows you a clearer picture of what you are able to do with text search in DB2® Content Manager.
Introduction
Several DB2® Content Manager Version 8 applications place text-searchable parts within the same item in a DB2® Content Manager system. You need to be able to search only the text-searchable parts belonging to an application, and exclude other text-searchable parts from the search. Typical heuristic approaches supplement information in DB2® Content Manager systems by adding their own text-searchable parts, and then searching these parts to find an answer to your query. The problem with the typical heuristic approaches in the scenario where several applications are involved is that all the text-searchable parts are searched, instead of just the ones belonging to a specific application. This article shows how to perform a text search of only the text-searchable parts you are interested in. Searching the text-searchable parts you are interested in does not require an heuristic approach.
Text search solution
In DB2® Content Manager there is a view called ICMPARTS which contains library information about each part belonging to an item. This view includes the attributes RESOURCENUM and TIEREF. RESOURCENUM contains the part number belonging to an item. TIEREF is a reference to the text-searchable parts. These two attributes are the key to finding and searching the specific text-searchable parts belonging to your application. Several query string examples are shown below to demonstrate how these attributes are employed in a text search.
Suppose one of the applications places in text-searchable part number 11 for ItemType Example, and you want to search for the phrase "Stochastic Processes" in this part. In basic search, you would enter the search string as follows:
/Example[contains-text-basic(.//ICMPARTS[@RESOURCENUM=11]/@TIEREF, " +'Stochastic Processes' ")=1]
The + sign in the above example before the phrase "Stochastic Processes" means that you are searching for this phrase.
If you use contains-text, this is equivalent to using contains-text-db2. Here are the equivalent advanced search strings for contains-text-db2 and contains-text-oracle:
/Example[contains-text-db2(.//ICMPARTS[@RESOURCENUM=11]/@TIEREF, " 'Stochastic Processes' ")=1]
/Example[contains-text-oracle(.//ICMPARTS[@RESOURCENUM=11]/@TIEREF, " 'Stochastic Processes' ")>0]
As another example, suppose that you are searching the text-searchable part number 11 in ItemType Example for the nonoccurrence of the phrase "Stochastic Processes." In basic search, you would enter the search string as follows:
/Example[contains-text-basic(.//ICMPARTS[@RESOURCENUM=11]/@TIEREF, " -'Stochastic Processes' ")=1]
The - sign in the above example before the phrase "Stochastic Processes" means that you are not searching for this phrase.
Here are the equivalent advanced search strings for contains-text-db2 and contains-text-oracle:
/Example[contains-text-db2(.//ICMPARTS[@RESOURCENUM=11]/@TIEREF, " NOT 'Stochastic Processes' ")=1]
/Example[contains-text-oracle(.//ICMPARTS[@RESOURCENUM=11]/@TIEREF, " NOT 'Stochastic Processes' ")>0]
In this example, one of the applications places in text-searchable parts 11, 21, and 25 into ItemType Example. You want to search only these text-searchable parts for the phrase "Infinity and beyond." Here is the advanced search string using contains-text-db2:
/Example[contains-text-db2(.//ICMPARTS[@RESOURCENUM IN (11,21,25)]/@TIEREF, " 'Infinity and beyond' ")=1]
In advanced search, you can use & (AND) and | (OR) operators. You can perform fuzzy searches and use boolean logic. Basic Search allows you to use + and - but you can not use boolean operators or more complex expressions.
DB2® Content Manager comes with sample programs. SSearchICM.java is a Java® program which shows you how to use search. You can use this program to test the search strings presented above, and see that you get the expected results. You can replace the Example ItemType with some other ItemType you already have, and use different part numbers and phrases to see that this solution enables you to work with a subset of all the text-searchable parts.
Summary
These examples have shown how to search a subset of all the text-searchable parts. This allows you to work with different applications that have placed text-searchable parts into the same item within an ItemType. By using a subset of all the text-searchable parts, you can obtain the desired result from search and present to the user the expected result, without needing to take an heuristic approach.
Resources
About the author  | |  | Michael S. Schwartz is a Senior Software Engineer, working with databases, WebSphere, and Content Management among other areas. Michael has a Ph.D. in Mathematics. He has written papers on DB2, Content Management, and Records Management. |
Rate this page
|