CBR query syntax introduction
A CBR query includes a CONTAINS function call to perform a full-text search.
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 DateReceived 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.