You can use ItemLastPublishedDateCriteria criteria to specify the last published date filter that you are looking for, for retrieving the pages that were published after specific date.
Given below is the sample code to achieve the same.
var itemTypeCriteria = new ItemTypeCriteria(64);
var lastPublishedCriteria = new ItemLastPublishedDateCriteria(<...
@Kris, I am assuming you have custom meta value as a comma separated string. You can use SQL like pattern %% to match the value. So your custom meta value criteria should be like:
CustomMetaValueCriteria customMetaValueCriteria = new CustomMetaValueCriteria(metaField, "%keywordValue%", Criteria.Like);
You can fit this code in your application code.
Thought I would post this as it may help someone else if you run into this problem. Have received the following response from SDL support who solved the issue.
I have investigated further and observed that the code shared in
previous notes was failing to include NotInCriteria when more than one
keyword is used in excludeKeywords array. This was ...
Here are a couple of issues with your logic:
new KeywordCriteria(yearTaxonomyId, yearIds.ToArray()) creates a criteria where an item is tagged with all the Keywords in your array. You seem to be looking for OR here. So you will need to create individual KeywordCriteria for each year and OR them together.
new KeywordCriteria(yearTaxonomyId, yearIds.ToArray(...
I don't see that the ComponentPresentationFactory has any methods which accept an array of component IDs that would return you multiple ComponentPresentations. There are two methods which accept a Keyword or Keywords which could possibly be used if you are classifying your news components?
Many implementations do this kind of querying for multiple pieces of ...
Something like this was done before through the use of a Metadata Processor extension in CWA and the Tridion Delivery Framework, where the additional data was made available as part of the item and then in a storage extension moved to the metadata before saved in the Broker.
See also: Dynamic metadata using Tridion Delivery Framework (TDF) in 2011?
And I ...
Just a little enhancement to the accepted answer given by Hiren above....
Presumably, you're not looking for the exact date and time (including the exact second!) that an item was published, so you're going to want to use second FieldOperator parameter (e.g. Criteria.GreaterThanOrEqual) when creating the ItemLastPublishedDateCriteria objects, so you can ...
If you are quering from a local machine then it could be an issue with your license file.
Common issues are:
The license file can't be found
The license file doesn't contain a broker license
The license file is not valid for your machine
In all cases the broker will fall back to using its built-in ItemType mappings. In other words: it will only support ...
So, I went back to my good old SQL Server, started Query Profiler on the Tridion DB and found my answer.
When using multiple search terms, the SQL IN operator is used, and the Tridion Criteria.Like operator is ignored!!!
In particular look at this snippet from the full code:
searchArray = Array.ConvertAll(searchArray, x => "%" + x.Trim() + "%");
In general, the datatype Float has limited precision; it has a huge range, but it is not possible to represent every integer value within that range.
So, in general, exact matches on float values are tricky: you may get both false positive and false negative matches.
Bottom line: if you want to do exact matches, you should not use datatype Float (nor ...
See DefaultContentProvider.PopulateDynamicList for an example of how to build DXA Entity Models out of a list of Component TCM URIs.
Indeed, the first part of the solution is to get Component Meta. The DXA Model Builder Pipeline can then be used to build an Entity Model out of it. Note that Component Meta does not contain Component content, though. So, ...
I have seen this type of problem before. In our case the problem was due to schema changes.
When a schema metadata field data type has been changed you must
update all components using the schema
republish items using the schema
Check the metadata field type in the broker database to verify that all of the published metadata is the correct type.
What have you tried so far? I'm asking because this question is a "do my homework instead of me" type, so there is little chance that someone will write your code instead of you. Best we can do is give you some hints, and then using the API found HERE you can easily put together your own code. For debugging purposes you can attach to the Template Builder ...
I’m a bit confused by your comment “this is going to be on a TBB and run at the runtime. This code won’t run at the rendering time.”
In general, TBB code runs at rendering time. And the reason why Jonathan asked for it, is because only templating and event handler code is supposed to use the TOM.NET (rather than the Core Service).
Anyways, assuming that ...
It works , i got the solution :)
ComponentPresentation cp = cpf.GetComponentPresentation(uri, templateUri);
// check if component presentation is published to the broker
if (cp != null)
IComponentMeta meta = cmf.GetMeta(uri);
CustomMeta customMeta = meta.CustomMeta;
NameValuePair nvp = (...
The predefined Content Query schema, associated ContentList View Model, ListController and DefaultContentProvider.PopulateDynamicList are currently functionally quite limited.
However, they do demonstrate a pattern you can implement yourself to do whatever kind of dynamic, query based list implementation:
Create your own list Schema and associated View ...
To achieve the desired result you should use following two additional conditions:
LimitFilter - To limit no of components to 4
NotInCriteria - To exclude the component that you already have.
Let me know if you are still facing any issues.
Updated code will be something like:
AndCriteria totalCriteria = null;//this will be used for combining all kind of ...
Not sure, if you have already found the answer.
A workaround would be not to include the optional field in the search criteria.
ComponentFactory cpf = new ComponentFactory();
Query query = new Query();
//16 for component, 32 for CTs, 64 for Page, here we are dealing with type 16 i.e. components only
ItemTypeCriteria componentsOnly = new ItemTypeCriteria(...