CBR queries using Enterprise Manager

Content-based retrieval (CBR) allows you to easily find objects based on the indexed words they contain. For example, you can request a list of all documents that contain the words “structural stability.”

You can run CBR queries using the following applications:

Enterprise Manager allows CBR queries to be run on only one object store at a time. The Content Engine API and Search Designer allow CBR queries to be run on multiple object stores at the same time.

The Content Engine Query Builder in Enterprise Manager allows you to create CBR queries. The results returned from CBR queries depend on which components of an object store have been indexed. You can index content elements of documents and annotations, which are stored by the Verity engine. You can also index the relational string-valued properties of documents, annotations, folders, and custom objects, which are stored in a separate database. For example, authors' names can be indexed, even if the names don't appear in the content of the documents themselves.

CBR queries use a combination of SQL and Verity Query Language syntax. See Create, load, and save a SQL query and SQL Syntax Reference for additional information about building queries.

Row limitations

You can set three types of row limits that can help you limit the time and resources consumed by a given query. However, if you set your row limit too low, you can stop the query before all matches are found. For example, if you are querying for documents that include the phrase “structural stability,” written by Lee Lindz, the object store might contain more documents that contain the phrase "structural stability" than your row limit allows. If the row limit stops the query before all "structural stability" documents have been found, the query might not yet have reached the Lindz document.

FULLTEXTROWLIMIT is a SQL statement option that you can include in your query.

FullTextRowDefault is a property of the object store and specifies the default number of rows that can be returned from the indexing data during a search. You can exceed the FullTextRowDefault by using a larger value in FULLTEXTROWLIMIT option in your query. If you do not specify a value for FULLTEXTROWLIMIT, the value stored in the FullTextRowDefault property is used for your query.

FullTextRowMax is a property of the object store and specifies the maximum number of rows that can be returned from the indexing data during a search. If you specify a value for the FULLTEXTROWLIMIT option in your SQL statement, the lesser of the FullTextRowMax and the FILLTEXTROWLIMIT values is used as the maximum number of rows that can be returned.

Refer to the Developer's Guide and SQL Syntax Reference for additional information about row limits.

Querying collection partitions

To search Verity collection partitions, the WHERE clause of a query must contain conditions on the partitioning property; otherwise, all collections are searched. For example, assume that a class has a custom property called receivedDate on which to partition documents, and the object store on which the class resides is configured to use receivedDate as the partitioning property. The following query statement invokes a search on partitioned collections.

SELECT … FROM Document D INNER JOIN ContentSearch CS ON
	D.This=CS.QueriedObject WHERE CONTAINS(*,'dog') AND
	D.receivedDate >= 2008-10-26 AND D.receivedDate < 2009-03-25

This query narrows the Verity search to those collections with date ranges that overlap the specified range of values for the receivedDate property. If no collections cover the specified range of dates, the query returns zero results.

For the Verity search to be optimized, you must specify the conditions referencing the partitioning property (receivedDate in this example) at the top level of the query; that is, the conditions must be separated by AND conjunctions at the highest level. Otherwise, the parsing of the query might result in a Verity search that scans all of the Verity collections.

Specifying a time range

If you include a time range when querying on the partitioning property, you must specify the hour, minute, and second. Note, however, that the specified minute and second are ignored; that is, the minute and second values are automatically rounded down to zero. This behavior can have unexpected results, as shown in the following examples.