5

I would like to confirm that I'm not missing something in the API docs. I don't see a way to apply a filter to get components modified after a specified date. I'm using OrganizationalItemItemsFilterData to get components in a specified folder. I want to get only items modified after a specific date. So, I guess I will get all items and then loop through and exclude those that don't meet the criteria. I wanted to confirm I'm not missing this in the API.

Update: trying to use SearchQueryData API and not getting any results with this code (via PowerShell) though it worked fine using GetList (then filtering)

        $filter = New-Object Tridion.ContentManager.CoreService.Client.SearchQueryData
        #want full objects
        $filter.BaseColumns = 3

        #want only items of requested type.
        $filter.ItemTypes = $ItemTypes

        #set folder
        $folderLink = New-Object Tridion.ContentManager.CoreService.Client.LinkToIdentifiableObjectData
        $folderLink.IdRef = $folder.Id
        $filter.SearchIn = $folderLink


        #set date
        $filter.ModifiedAfter = $ModifiedDate

        #recursive?
        if ($Recursive)
        {
            $filter.SearchInSubtree = $true
        }
        else
        {
            $filter.SearchInSubtree = $false
        }
        $client = Get-TridionCoreServiceClient
        $client.GetSearchResults($filter)
  • Syav4eg has a good point on the search service. Is it running and does a similar "Date modified" search work in the Content Manager Explorer? The docs explain setting ModifiedAfter should set ModifiedBefore to the current date and time, so the filter looks good. For BaseColumns, I understand 3 (for enum value Extended) only applies to ListItems (so maybe not search?). Maybe try 2 (for Default) or null. The docs mention for BaseColumns, "When null is specified, the condition is not applied." – Alvin Reyes Jul 7 '14 at 23:17
  • Maybe GetList and then some caching? Or, persist to some external repo like Redis, OrmLite, etc? – robrtc Jul 8 '14 at 7:48
  • Alvin: I tried taking out the BaseColumns completely and still no results. I re-indexed all content and still the same. zero results. – Warner Soditus Jul 9 '14 at 0:39
  • Is it working when searching through the GUI? Can you save the search and then compare the params to your code above? – robrtc Jul 9 '14 at 9:48
  • apparently it is something specific about search on the test box I was using. it does appear to work properly on another server. – Warner Soditus Jul 10 '14 at 15:00
4

You should be able to use a ICoreService2011.GetSearchResults in combination with a Tridion.ContentManager.Data.ContentManagement.SearchQueryData object for this.

| improve this answer | |
  • hm... trying that, but not having any luck. will provide code in edit above. – Warner Soditus Jul 7 '14 at 18:56
2

It is some kind of dilemma, what to use - search API, or GetList + post-processing(filtering).

GetList+ PostProcessing can lead to performance decrease. Depending on property you use(probably now it is ModificationDate) - you can get N+1 problem. 1 Query for getting list, another N for loading N items from your list (note, getting list returns only part of the properties in the dataObject, and some of them after getting list through CoreService will have null value. So you need to ReLoad item, using its id for getting this property).

But, if modification date is already presented in dataObjects - you can filter without any doubts. Btw, Search API does very similar things - gets items by search term(title) and after that post-processing is made according to SearchQueryData.

I am not a big fun of using Search Api in your extensions for looking to some stuff. It has another appointment, but a lot of guys use it instead of getting lists. Sometimes (like in your case) it doesn't return some/any results. As a reason can be stopped "Tridion Search Indexer Service". So, from my side conclusion is next - for fast getting estimate number of items - use search. For getting accurate values for your business logic - use GetList.

| improve this answer | |
  • accuracy is more important than efficiency as this is an off-line process... will explore why it's not working at all via search api. appreciate the insights!! – Warner Soditus Jul 8 '14 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.