Matching a pattern (SQL LIKE)
You specify your query criteria by calling SetCriteria on your query object. This method takes an object that is a subclass of the Criteria class as its sole parameter.
The various constructors for the subclasses of Criteria have an optional last parameter of class FieldOperator. This parameter specifies how the field being examined should be compared to the value supplied. If no such parameter is specified, it is assumed to be FieldOperator.EQUALS, that is, the field and the value are assumed to need to be an exact match.
If the field you are examining is string-based, you can (among others) specify a parameter FieldOperator.LIKE, which lets the query return those items for which the field matches the supplied string using the LIKE command of SQL. That is, you can create a string containing SQL wildcard characters.
For example:
PageURLCriteria criteria = new PageURLCriteria("/some/url")matches all pages which have a relative URL that is equal to "/some/url ".PageURLCriteria criteria = new PageURLCriteria("/some/url%", Criteria.LIKE)match all pages which have a relative URL that is like "/some/url%"; that is, all pages whose relative URL begins with "/some/url".
The LIKE operator FieldOperator.LIKE can be used with the following criteria:
CategoryCriteriaKeywordCriteriaCustomMetaValueCriteriaCustomMetaKeyCriteriaItemTitleCriteriaPageURLCriteriaTaxonomyKeywordDescriptionCriteria