CBR query syntax introduction

A CBR query includes a CONTAINS function call to perform a full-text search. Because IBM® Content Search Services uses the Lucene text search engine, the search expression syntax must generally conform to Lucene syntax.

You can also use an XPath-based syntax for searching XML documents. For an XML document to be searchable as XML, the document must be the sole content element for a Content Engine object. The content of objects with multiple content elements is treated as text (as opposed to XML) even though some or all of the content element files might be XML documents.

The following example shows the main syntactical elements of a CBR query:

SELECT d.This FROM Document d 
        INNER JOIN ContentSearch c ON d.This = c.QueriedObject 
        WHERE CONTAINS(d.*,'lion AND tiger')
        ORDER BY c.Rank
        OPTIONS (FULLTEXTROWLIMIT 500)

Using partition properties in a query to optimize query performance

To optimize query performance, use a partition property in the WHERE clause of the SQL statement. The search terms that reference the partition property must be separated by AND conjunctions at the highest level of the query. For example, suppose that DateCreated is a partition property. The following query shows how a DateReceived custom property might be referenced to optimize search performance:

SELECT d.This FROM Document d 
        INNER JOIN ContentSearch c ON d.This = c.QueriedObject 
        WHERE CONTAINS(d.*,'lion AND tiger')
               AND d.DateReceived >= 2008-10-26 
               AND d.DateReceived < 2009-03-25
        ORDER BY c.Rank
        OPTIONS (FULLTEXTROWLIMIT 500)

Using a partition property in this way in the query has the following effect: the full-text search is narrowed to the indexes with partition property values that overlap the query-specified range of property values. In this example, the query-specified range of values for DateReceived is from 2008-10-26 to 2009-03-25. Consequently, the lion AND tiger search is narrowed to those indexes with an overlapping range of DateReceived values for the objects indexed.

Related reference
For detailed information about CBR query syntax and the ranking factors, see CBR queries using IBM Content Search Services. For information about the Indexing Language property, see Object store properties (CBR IBM Search tab).

Related concepts
For information about index partitions, see Index partitions. For information about word stems, see Word stems. For information about stop words, see Stop words. For information about synonyms, see Synonyms.

Related tasks
For information about partitioning indexes, see Configuring index partitions. For information about submitting a CBR query, see Submitting a CBR query from Enterprise Manager.