Integrating Search

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Metadata Searching

Content Management supports metadata search as well as full-text search. This chapter describes searching for both published and versioned metadata. Published content is either content from a repository that does not have library services enabled or content that has completed a workflow and is a Published state. Versioned content is content in a library services-enabled repository that is not yet published. Searching for published content returns Nodes while searching for unpublished content return Versions. For more information about enabling library services, see Enabling Library Services for a WLP Repository in the Content Management Guide.

Note: Searching for published content and searching for versioned content are mutually exclusive because these search types use different APIs. and You use ISearchManager.search to search for published content and IVersionManager.search to search for versioned content. This means that the search queries go against different data sources to return the data.

This chapter contains the following sections:

 


Introduction

The metadata search feature uses the content expression language. You use different properties when searching for metadata in published content and versioned content. The differences are discussed in the relevant sections. A full list of supported properties is available in com.bea.content.expression in the WebLogic Portal Javadoc.

 


Searching for Metadata in Published Content

This section describes searching for metadata in published content. The following sections provide more detail:

Properties

The following tables describe commonly used properties and operators A full list of supported properties is available in com.bea.content.expression in the WebLogic Portal Javadoc.

Table 5-1 System Properties
System Property
Description and Example
cm_path
The Virtual Content Repository path to the content item.
cm_path = 'WLP Repository/books/Ulysses'
cm_uid
The unique ID for a content item.
cm_uid = '0003456'
cm_parent_uid
The ID of the parent for a content item.
cm_parent_uid = '87543'
cm_createdBy
The user who created the content item.
cm_createdBy = 'jjoyce'
cm_modifiedDate
The date the content item was last modified.
cm_modifiedDate = '04/01/2008'
cm_nodeName
The name of the content item.
cm_nodeName != 'abc'
cm_isHierarchy
Deprecated.
cm_isContent
Deprecated.
cm_objectClass
The content type associated with a content item.
cm_objectClass = 'simpleType'
cm_binaryName
The file name of the binary value of a content item.
cm_binaryName = 'foo.gif'
cm_binarySize
The size of the binary value of a content item (in bytes)
cm_binarySize = '188'
cm_contentType
The MIME type for content item binary properties.
cm_contentType = 'image/gif'
cm_objectClassInstance
Finds all instances of a given object class and all of its children.
cm_objectClassInstance = 'Product'
cm_value
Find any property value on any nodes of a particular value.
cm_value = 'red'

Table 5-2 Operators
Operator
Purpose
like
Syntax textual like operator.
likeignorecase
Syntax textual like (case insensitive) operator.
=
Syntax textual equals operator.
!=
Syntax textual not equals operator.
&&
Syntax textual and logical operator.
in()
Syntax textual in operator.
! [negate]
Syntax textual not operator.
||
Syntax textual or logical operator.
>
Syntax textual greater than operator.
<
Syntax textual less than operator.
contains
Syntax textual contains operator.
containsall()
Syntax textual contains all operator.
containsany()
Syntax textual contains any operator.
toProperty('<propertyName>')
Use for special characters in property names such as spaces, backslash, and so on.

Table 5-3 Wildcards
Wildcard
Description
Example
*
Supports any characters.
cm_NodeName like “ab*” matches “abcde”, “ab”, “ab234”, “abc”, and so on.
_
Supports one character.
cm_nodeName like “ab_” matches “abc”, “abd”, “ab2”, and so on.

The Search Object

You can search for metadata in a content repository using the com.bea.content.search object. The search object takes in an expression that the API processes and return search results as com.bea.content.Node objects. Listing 5-1 shows an example of a simple search.

Listing 5-1 Simple Search Example
ISearchManager searchManager = ContentManagerFactory.getSearchManager();
Search search = new Search(“cm_nodeName != null”);
search.setSortCriteria("cm_objectClass, cm_nodeName");
ISortableFilterablePagedList<Node> nodes =
   searchManager.search(context, search);

The search manager API also supports various other types of searches like idSearch. For more information, see the WebLogic Portal Javadoc.

Limitations

When using the WLP repository, metadata search results on implicit properties cannot be sorted. To sort the returned data you must use postSearchSort method in the ISearchManager API. That method is slower than native sorting, which is done using the search.setSortCriteria method.

Examples

The expression language supported by search is based on a simple, easy to use grammar. It supports a rich set of operations, and easily allows building complex queries using nested expressions. To look at the various data types, such as strings, dates, numbers, and booleans supported by the expression language, For more information, see the WebLogic Portal Javadoc.

Table 5-4 Examples
Example
Description
cm_nodeName = 'hello'

Returns all the nodes matching the name “hello”.

cm_nodeName = 'hello' || cm_nodeName =
   'world'
Finds any node name that has the name “hello” or “world”.
cm_nodeName = 'hello' && city =
   'boston'
Find any node name of name “hello” and city of “boston”.
cm_nodeName = 'hello' && (color =
   'red' || color = 'blue')
Use the brackets ( and ) to find nested expressions. Nesting follows a left to right order of evaluation. This expression finds all nodes named hello, and whose color property is either “red” or “blue”.
Complex Nesting Examples
cm_nodeName = 'hello' &&
   ( (city = 'boston' || city =
   'boulder' ) && (color = 'red') )
Finds any node named “hello” and whose color property is “red” and whose city property is either “boulder” or “boston”.
!(cm_nodeName = 'hello' && city =
   'boston')

The negation ! operator returns an inverse result. In this example, all the nodes that do not have the name “hello” and the city “boston” are returned.

 


Searching for Metadata in Versioned Content

This chapter describes searching for metadata search in versioned content. It contains the following sections:

Specific Properties for Versions

Property
Description and Example
cm_version
The version number of the content.
cm_version = '6'
cm_versionComment
Text describing the changes to the version.
cm_versionComment = 'Updates from Marketing'
cm_checkedOut
Version is checked out.
cm_checkedOut = 'false'
cm_assignedToUser
The user to which the node is assigned.
cm_assignedToUser = 'rjordan'
cm_role
The role to which the node is assigned.
cm_role = 'Admin'
cm_latestVersion
The latest version of the content.
cm_latestVersion = 'true'

Limitations

Search for versioned content has some limitations because the tables that store versioned data can be in a different data store than the ones that store published data. This means that you cannot search for both published and versioned metadata with SQL queries. Therefore some properties are not supported when searching on versioned content. Here’s a list of unsupported properties:

Searching for versioned content and searching for published content are mutually exclusive because these search types use different APIs.

Supported Attributes

Attributes that retain their meaning from searching on versioned content are:

Table 5-5 Supported Attributes for Versioned Content Search
Attribute
Description
cm_nodeName
Search for node name.
cm_uid
Search for node by UID (User Identifier).
cm_value
Search for any value in versioned data
cm_lifeCycleStatus
Searching for nodes in any workflow state. For example, cm_lifeCycleStatus = '3' (Ready for Approval).

Examples

Table 5-6 shows some examples for searching versioned content (content used in a workflow).

Table 5-6 Searching Versioned Content
Example
Description
name = 'matt' && (age = 33 || age = 13)
Returns node versions matching the name “matt” and age of “13” or “33”.
cm_version = '1' && city = 'calcutta'
Returns the first version of nodes and city of “calcutta”.
cm_versionComment =
'DevUpdates' && product = 'portal'
Returns node versions that equal comments with “DevUpdates” for the “portal” product.
cm_modifiedBy = 'weblogic' && product = 'portal'
Finds node versions modified by “weblogic” for the “portal” product.
cm_lifeCycleStatus > 0 && article = 'development'
Returns node versions in any workflow state and articles about “development”.
cm_nodeName = 'matt_2' &&
   city = 'calcutta'
Returns node versions matching the name “matt_2” and city of “calcutta”.
cm_checkedOut = true
Finds node versions that are checked out.
cm_assignedToUser != null
Returns versioned nodes that are assigned to users.
cm_value > 30 || cm_binaryName = null
Finds node versions for any property with a value greater than “30” or whose file name of a binary value is unknown or undefined.
cm_role in ('weblogic','Admin') && cm_value > 30
Finds node versions that have roles in “weblogic” and “Admin” and any property with a value greater than “30”.
cm_version = '5'
Returns node versions with a version number of “5”.
age > 10 && (city in ('calcutta','boulder') || cm_role = 'Admin')
Finds node versions with an age value greater than “10” and city of “calcutta” and “boulder” or role assigned to “Admin”.
cm_uid = '2051' && city = 'boulder'
Finds node versions with node ID “2051” and city of “boulder”
cm_nodeName = 'foo' && cm_latestVersion = true
Returns the latest version of nodes named “foo”.


  Back to Top       Previous  Next