Documentation Center

Filter criteria examples

This topic lists examples (valid ASP.NET code and JSP code) of criteria objects being created, along with an explanation of what the criteria will match.

The code fragments are valid ASP.NET code and JSP code.

  • Date july2008 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2008-07-06 00:00:00.000");
    ItemCreationDateCriteria criteria = new ItemCreationDateCriteria(july2008);

    matches all items that were created on July 6, 2008 at midnight.

  • Date july2008 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2008-07-06 00:00:00.000");
    ItemCreationDateCriteria criteria = new ItemCreationDateCriteria(july2008, Criteria.GREATER_THAN);

    matches all items that were created after July 6, 2008 at midnight.

  • ItemCreationDateCriteria criteria = new ItemCreationDateCriteria("2008-07-06 00:00:00.000");

    matches all items that were created on July 6, 2008 at midnight.

  • ItemCreationDateCriteria criteria = new ItemCreationDateCriteria("2008-07-06 00:00:00.000", "yyyy-MM-dd HH:mm:ss.SSS");

    matches all items that were created on July 6, 2008 at midnight.

  • ItemCreationDateCriteria criteria = new ItemCreationDateCriteria("2008-07-06 00:00:00.000", Criteria.GREATER_THAN);

    matches all items that were created after July 6, 2008 a midnight.

  • ItemCreationDateCriteria criteria = new ItemCreationDateCriteria("2008-07-06 00:00:00.000", "yyyy-MM-dd HH:mm:ss.SSS", Criteria.GREATER_THAN);

    matches all items that were created after July 6, 2008 at midnight.

  • Date july2008 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2008-07-06 00:00:00.000");
    ItemModificationDateCriteria criteria = new ItemModificationDateCriteria(july2008);

    matches all items that were modified on July 6, 2008 at midnight.

  • Date july2008 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2008-07-06 00:00:00.000");
    ItemModificationDateCriteria criteria = new ItemModificationDateCriteria(july2008, Criteria.GREATER_THAN);

    matches all items that were modified after July 6, 2008 at midnight.

  • ItemModificationDateCriteria criteria = new ItemModificationDateCriteria("2008-07-06 00:00:00.000");

    matches all items that were modified on July 6, 2008 at midnight.

  • ItemModificationDateCriteria criteria = new ItemModificationDateCriteria("2008-07-06 00:00:00.000", "yyyy-MM-dd HH:mm:ss.SSS");

    matches all items that were modified on July 6, 2008 at midnight.

  • ItemModificationDateCriteria criteria = new ItemModificationDateCriteria("2008-07-06 00:00:00.000", Criteria.GREATER_THAN);

    matches all items that were modified after July 6, 2008 a midnight.

  • ItemModificationDateCriteria criteria = new ItemModificationDateCriteria("2008-07-06 00:00:00.000", "yyyy-MM-dd HH:mm:ss.SSS", Criteria.GREATER_THAN);

    matches all items that were modified after July 6, 2008 at midnight.

  • Date july2008 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2008-07-06 00:00:00.000");
    ItemInitialPublishDateCriteria criteria = new ItemInitialPublishDateCriteria(july2008);

    matches all items that were initially published on July 6, 2008 at midnight.

  • Date july2008 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2008-07-06 00:00:00.000");
    ItemInitialPublishDateCriteria criteria = new ItemInitialPublishDateCriteria(july2008, Criteria.GREATER_THAN);

    matches all items that were initially published after July 6, 2008 at midnight.

  • ItemInitialPublishDateCriteria criteria = new ItemInitialPublishDateCriteria("2008-07-06 00:00:00.000");

    matches all items that were initially published on July 6, 2008 at midnight.

  • ItemInitialPublishDateCriteria criteria = new ItemInitialPublishDateCriteria("2008-07-06 00:00:00.000", "yyyy-MM-dd HH:mm:ss.SSS");

    matches all items that were initially published on July 6, 2008 at midnight.

  • ItemInitialPublishDateCriteria criteria = new ItemInitialPublishDateCriteria("2008-07-06 00:00:00.000", Criteria.GREATER_THAN);

    matches all items that were initially published after July 6, 2008 a midnight.

  • ItemInitialPublishDateCriteria criteria = new ItemInitialPublishDateCriteria("2008-07-06 00:00:00.000", "yyyy-MM-dd HH:mm:ss.SSS", Criteria.GREATER_THAN);

    matches all items that were initially published after July 6, 2008 at midnight.

  • CustomMetaKeyCriteria floatFieldCriteria = new CustomMetaKeyCriteria("fieldFloat");

    matches all items that have custom metadata with a key name set to "fieldFloat".

  • CustomMetaKeyCriteria cCriteria = new CustomMetaKeyCriteria("a", FieldOperator.GREATER_THAN);

    matches all items that have custom metadata with a key name set to a larger string value than "a".

  • CustomMetaValueCriteria customMetaString = new CustomMetaValueCriteria("MyValue1");

    matches all items that have a custom metadata string with a value "MyValue1"

  • CustomMetaValueCriteria customMetaFloat = new CustomMetaValueCriteria(new Float(10));

    matches all items that have a custom metadata floating point field with a value 10.

  • Date june2008 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2008-06-02 00:00:00.000");
    CustomMetaValueCriteria customMetaDate = new CustomMetaValueCriteria(june2008);

    matches all items that have a custom metadata date field set to the value of 2nd June of 2008, midnight.

  • CustomMetaValueCriteria customMetaString = new CustomMetaValueCriteria("a", FieldOperator.GREATER_THAN);

    matches all items that have a custom metadata string field with a value larger than "a".

  • CustomMetaValueCriteria customMetaFloat = new CustomMetaValueCriteria(new Float(10), FieldOperator.GREATER_THAN);

    matches all items that have a custom metadata floating point field with a value higher than 10.

  • Date june2008 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2008-06-02 00:00:00.000");
    CustomMetaValueCriteria customMetaDate = new CustomMetaValueCriteria(june2008, FieldOperator.GREATER_THAN);

    matches all items that have a custom metadata date field set to the value that is later than 2nd June of 2008, midnight.

  • CustomMetaValueCriteria customMetaString = new CustomMetaValueCriteria("a%", FieldOperator.LIKE);

    matches all items that have a custom metadata string field with a value that matches the SQL LIKE pattern "a%".

  • Date june2008 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2008-06-02 00:00:00.000");
    Date may2009 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2009-05-02 00:00:00.000");
    CustomMetaDateRangeCriteria dateRange = new CustomMetaDateRangeCriteria(june2008, may2009);

    matches all items that have any custom metadata date field with a value that is within the two dates supplied.

  • Date june2008 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2008-06-02 00:00:00.000");
    Date may2009 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2009-05-02 00:00:00.000");
    CustomMetaDateRangeCriteria dateRange = new CustomMetaDateRangeCriteria("customMetaName", june2008, may2009);

    matches all items that have a custom metadata date field called "customMetaName" with a value that is within the two dates supplied.

  • CustomMetaStringRangeCriteria stringRange = new CustomMetaStringRangeCriteria("a", "b");

    matches all items that have any custom metadata string field with a value that is between "a" and "b".

  • CustomMetaStringRangeCriteria stringRange = new CustomMetaStringRangeCriteria("customMetaName", "a", "b");

    matches all items that have a custom metadata string field called "customMetaName" with a value that is between "a" and "b".

  • BinaryTypeCriteria criteria = new BinaryTypeCriteria("image/jpg");

    matches all items (that have been already identified as binaries) that have the MIME type indicated.

  • PageURLCriteria criteria = new PageURLCriteria("/some/url");

    matches all items (that have been already identified as Pages) that have a relative URL set to /some/url.

  • PageURLCriteria criteria = new PageURLCriteria("/some/url", Criteria.GREATER_THAN);

    matches all items (that have been already identified as Pages) that have a relative URL as a string with a higher value than /some/url.

  • PageURLCriteria criteria = new PageURLCriteria("/some/url%", Criteria.LIKE);

    matches all items (that have been already identified as Pages) that have a relative URL that matches the SQL LIKE patterns /some/url%.

  • PageTemplateCriteria criteria = new PageTemplateCriteria(47);

    matches all items (that have been already identified as Pages) that have a Page Template with an ID with the value 47.

  • PageTemplateCriteria criteria = new PageTemplateCriteria(47, Criteria.GREATER_THAN);

    matches all items (that have been already identified as Pages) that have a Page Template with an ID with a value higher than 47.

  • PublicationTitleCriteria criteria = new PublicationTitleCriteria("someTitle");

    matches all items in Publications that have their title set to "someTitle".

  • PublicationTitleCriteria criteria = new PublicationTitleCriteria("someTitle", Criteria.GREATER_THAN);

    matches all items in Publications that have their title set to a string value larger than "someTitle".

  • PublicationTitleCriteria criteria = new PublicationTitleCriteria("someTitle%", Criteria.LIKE);

    matches all items in Publications that have their title set to a value that matches the SQL LIKE pattern "someTitle%".

  • PublicationKeyCriteria criteria = new PublicationKeyCriteria("someKey");

    matches all items in Publications that have a key (metadata property name) named "someKey".

  • PublicationKeyCriteria criteria = new PublicationKeyCriteria("someKey", Criteria.GREATER_THAN);

    matches all items in Publications that have a key (metadata property name) set to a string value larger than "someKey".

  • PublicationKeyCriteria criteria = new PublicationKeyCriteria("someKey%", Criteria.LIKE);

    matches all items in Publications that have a key (metadata property name) set to a value that matches the SQL LIKE pattern "someKey%".

  • PublicationURLCriteria criteria = new PublicationURLCriteria("/some/url");

    matches all items in Publications that have a URL named /some/url.

  • PublicationURLCriteria criteria = new PublicationURLCriteria("/some/url", Criteria.GREATER_THAN);

    matches all items in Publications that have a URL set to a string value larger than /some/url.

  • PublicationURLCriteria criteria = new PublicationURLCriteria("/some/url%", Criteria.LIKE);

    matches all items in Publications that have a URL set to a value that matches the SQL LIKE pattern "/some/url%".

  • PublicationPathCriteria criteria = new PublicationPathCriteria("/some/path");

    matches all items in Publications that have a path named /some/path.

  • PublicationPathCriteria criteria = new PublicationPathCriteria("/some/path", Criteria.GREATER_THAN);

    matches all items in Publications that have a path set to a string value larger than /some/path.

  • PublicationPathCriteria criteria = new PublicationPathCriteria("/some/path%", Criteria.LIKE);

    matches all items in Publications that have a path set to a value that matches the SQL LIKE pattern "/some/path%".

  • PublicationMultimediaPathCriteria criteria = new PublicationMultimediaPathCriteria("/some/MM/path");

    matches all items in Publications that have a multimedia path named /some/MM/path.

  • PublicationMultimediaPathCriteria criteria = new PublicationMultimediaPathCriteria("/some/MM/path", Criteria.GREATER_THAN);

    matches all items in Publications that have a multimedia path set to a string value larger than /some/MM/path.

  • PublicationMultimediaPathCriteria criteria = new PublicationMultimediaPathCriteria("/some/MM/path%", Criteria.LIKE);

    matches all items in Publications that have a multimedia path set to a value that matches the SQL LIKE pattern "/some/MM/path%".

  • PublicationMultimediaURLCriteria criteria = new PublicationMultimediaURLCriteria("/some/MM/url");

    matches all items in Publications that have a multimedia URL named /some/MM/url.

  • PublicationMultimediaURLCriteria criteria = new PublicationMultimediaURLCriteria("/some/MM/url", Criteria.GREATER_THAN);

    matches all items in Publications that have a multimedia URL set to a string value larger than /some/MM/url.

  • PublicationMultimediaURLCriteria criteria = new PublicationMultimediaURLCriteria("/some/MM/url%", Criteria.LIKE);

    matches all items in Publications that have a multimedia URL set to a value that matches the SQL LIKE pattern "/some/MM/url%".

  • StructureGroupTitleCriteria criteria = new StructureGroupTitleCriteria("myTitle");

    matches all Pages in a Structure Group that have a title with the value "myTitle".

  • StructureGroupTitleCriteria criteria = new StructureGroupTitleCriteria("myTitle%", FieldOperator.LIKE);

    matches all Pages in a Structure Group that have a title with a value matching the SQL LIKE pattern "myTitle%".

  • StructureGroupTitleCriteria criteria = new StructureGroupTitleCriteria("myTitle", FieldOperator.EQUAL, true);

    matches all Pages in a Structure Group, including sub-Structure Groups, that have a title with the value "myTitle".

  • SchemaTitleCriteria criteria = new SchemaTitleCriteria("someTitle");

    matches all Components that are based on a Schema with the title "someTitle".

  • SchemaTitleCriteria criteria = new SchemaTitleCriteria("someTitle", Criteria.GREATER_THAN);

    matches all Components that are based on a Schema with a title with a string value larger than "someTitle".

  • SchemaTitleCriteria criteria = new SchemaTitleCriteria("someTitle%", Criteria.LIKE);

    matches all Components that are based on a Schema with a title that matches the pattern "someTitle%".

  • TaxonomyUsedForIdentificationCriteria criteria = new TaxonomyUsedForIdentificationCriteria(true);

    matches all Pages tagged with Taxonomies that are used for identification.

  • TaxonomyKeywordNameCriteria criteria = new TaxonomyKeywordNameCriteria("tcm:3-12-512", "keywordName", true);

    matches all items tagged with Keywords that are children of the Keyword called "keywordName" with the Content Manager URI specified (that is, located in Taxonomy 12 in Publication 3).

  • TaxonomyKeywordNameCriteria criteria = new TaxonomyKeywordNameCriteria("tcm:3-12-512", "keywordName", false);

    matches all items tagged with the Keyword called "keywordName" with the Content Manager URI specified (that is, located in Taxonomy 12 in Publication 3).

  • TaxonomyKeywordNameCriteria criteria = new TaxonomyKeywordNameCriteria("tcm:3-12-512", "key%Nam%", true, FieldOperator.LIKE);

    matches all items tagged with the Keyword that are children of the Keyword that has a name matching the SQL LIKE pattern "key&Nam%" and the Content Manager URI specified (that is, located in Taxonomy 12 in Publication 3).

  • TaxonomyKeywordNameCriteria criteria = new TaxonomyKeywordNameCriteria(3, 12, "keywordName", true);

    matches all items tagged with Keywords that are children of a Keyword or Keywords called "keywordName" in Taxonomy 12 in Publication 3.

  • TaxonomyKeywordNameCriteria criteria = new TaxonomyKeywordNameCriteria(3, 12, "key%Nam%", true, FieldOperator.LIKE);

    matches all items tagged with Keywords that are children of a Keyword or Keywords matching the SQL LIKE pattenr "key%Nam%" in Taxonomy 12 in Publication 3.

  • TaxonomyKeywordKeyCriteria criteria = new TaxonomyKeywordKeyCriteria("tcm:3-12-512", "keywordKey", true);

    matches all items tagged with Keywords that are children of the Keyword that has a Key called "keywordKey" with the Content Manager URI specified (that is, located in Taxonomy 12 in Publication 3).

  • TaxonomyKeywordKeyCriteria criteria = new TaxonomyKeywordKeyCriteria("tcm:3-12-512", "keywordKey", false);

    matches all items tagged with the Keyword that has a Key called "keywordKey" with the Content Manager URI specified (that is, located in Taxonomy 12 in Publication 3).

  • TaxonomyKeywordKeyCriteria criteria = new TaxonomyKeywordKeyCriteria("tcm:3-12-512", "key%Ke%", true, FieldOperator.LIKE);

    matches all items tagged with the Keyword that are children of the Keyword that has a Key matching the SQL LIKE pattern "key&Ke%" and the Content Manager URI specified (that is, located in Taxonomy 12 in Publication 3).

  • TaxonomyKeywordKeyCriteria criteria = new TaxonomyKeywordKeyCriteria(3, 12, "keywordKey", true);

    matches all items tagged with Keywords that are children of a Keyword or Keywords that have a Key called "keywordKey" in Taxonomy 12 in Publication 3.

  • TaxonomyKeywordKeyCriteria criteria = new TaxonomyKeywordKeyCriteria(3, 12, "key%Ke%", true, FieldOperator.LIKE);

    matches all items tagged with Keywords that are children of a Keyword or Keywords that have a Key matching the SQL LIKE pattenr "key%Ke%" in Taxonomy 12 in Publication 3.