AEM 6.2:: Search cq:Page and dam:Asset with a specific tag and ordered by jcr:created - aem

I am trying to create PredicateGroup that would search all cq:Page and dam:Asset under respective paths. Further, these nodes are tagged with a specific tag and ordered by jcr:created.
Here is what I have written:
group.1_group.p.and=true
group.1_group.path=/content/some/path
group.1_group.type=cq:Page
group.1_group.1_property=#jcr:content/cq:tags
group.1_group.1_property.value=root:some/tag
group.p.or=true
group.2_group.p.and=true
group.2_group.path=/content/dam/some/path
group.2_group.type=dam:Asset
group.2_group.1_property=#jcr:content/metadata/cq:tags
group.2_group.1_property.value=root:some/tag
and it won't work on query debugger. I have also looked at this URL Search DAM assets and Cq pages using lastModified date | QueryBuilder and I don't know what I am doing wrong. Right now, I haven't added the condition for sorting because I was trying to go step by step.
Thanks in advance

Related

Is it possible to search for a rendition of an image based on the dimensions via QueryBuilder API

What I would like to achieve is the following. Based on the specified dimension and an asset title I would like to find all the asset renditions which correspond to the search criteria.
Currently, I am using the QueryBuilder API as I am not working in Java but it seems impossible that in just one call to the AEM I manage to get the wanted rendition.
What would be the best way for searching the image renditions?
Looking forward to your ideas!
You can do with SQL2 JOIN query:
SELECT parent.* FROM [dam:AssetContent] AS parent INNER JOIN [nt:file] AS child ON ISDESCENDANTNODE(child,parent) WHERE ISDESCENDANTNODE(parent, '/content/dam') AND parent.[cq:name]='men_5.jpg' and name(child)='cq5dam.thumbnail.48.48.png'
parent looks for dam:AssetContent nodes with name=men_5.jpg and child looks for nt:file nodes under corresponding asset with nodename=cq5dam.thumbnail.48.48.png

List all "incoming" internal links / references to a TYPO3 element

I need to get a list of elements linking to a specific TYPO3 page or element (all IDs oder pages, that link or refer to a this element). I thought this was at the Info module, but I can't find it.
I have spent hours finding this info on the web and even in my oldschool TYPO3 manual book... nothing, but I know that I once had this list.
Thanks a lot in advance! (version is TYPO3 4.6, I am preparing an upgrade right now)
You could search your database manually to find such links. I will start to give you a list where you could search for.
Find tt_content headers which link to a page, element or any url:
SELECT * FROM tt_content WHERE header_link NOT LIKE '' AND deleted = 0;
In RTE fields, you could manually check.
Go to backend modul 'Configuration', choose '$TCA (Tabel configuration array)' and search for 'RTE'.
Then you schould get all RTE fields, which could have links set to any TYPO3 pages or elements.
Like fx: tt_content.bodytext.config.wizards.RTE...
These fields you could search for any links vis MySQL
SELECT * FROM tt_content WHERE bodytext LIKE '%<link%' OR bodytext LIKE '%<LINK%' AND deleted = 0;
Maybe someone can add more default fields not listed above.
I think you have seen the references of a record normaly seen in the list module.
If you hover your mouse over the count you get a list of origins.
That list is not always up to date and the usability of the origins differs from version to version. Sometimes you can use the origins as direct link to edit the origin record.
Maybe you had an extension which enhances the usage.
In gerneral: if records are used with TYPO3 (TCA group fields which build relations to other records with uid-lists, or mm-records) this is also stored as refrence.
As links are also relations they are not always stored as referenes, espeacially if the link is inside a textfield.

Manual sorting of sys_category

On my TYPO3 7 site, i'm not able to choose an order to the categories of a page or a news (plugin tx_news). I can only choose what categories that page or news have, using the checkboxes to select them.
Is there any configuration for that?
Alternatively, I may override these fields with my own TCA, but have no ideas on how to get a sorting tree of categories. Any hint?
On my sites running previous TYPO3 versions with tt_news plugin, its category tree allows to change the sorting after selecting the categories.
I coudn't find anything about it on the "select" documentation (https://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Select/Index.html). Looks like MM relations doesn't support sorting.
Does anyone knows how to get it?
Make sure you have the "extended view" checked at the end of the page. You can then sort the sys_category-entries using the up/down arrows.
If you need to sort your categories per item and not globally then a default MM relation will not work as it doesn't support sorting. You're on the right track. Override or extend the TCA, don't specify a MM relation and don't use the tree view rendering. Use a standard select like you would select pages. This should store the values as a comma-list string in the database and so represent the sorting like you would see it the backend.

How to do a search by date query on cq pages

I am trying to create a blog in cq5. The OOTB search component in blog is not supporting search by date feature. I tried to override it, but could not find the correct query to fetch the blogs created on a particular date. Seems the only functions supported are >,>=,<,<=.
Please help me in finding a query (preferabbly xpath) to fetch a page created on a particular date (cq:lastModified).
There are some functions in XPath like contains or not. There is also one for date fields. Here an example for anything that was just modified in the content tree:
/jcr:root/content//*[#cq:lastModified >= xs:dateTime('2015-05-29T08:44:56.280Z')]

Search pages with a Tag in CQ5

I am working on a custom search component in CQ5. I need to search for 1 or more tags selected by user using checkboxes. I tried using an earlier query to search text (select * from cq:Pagecontent where...)
I tried using :
select * from cq:PageContent where cq:tags like '%mytag%'
but it is not working. There are 2 pages which have 'mytag' as tag.
Any suggestion on how to do it ?
The following query is working for me. I'm searching here for for the following tags marketing:interest/services and marketing:interest/product
//element(*,cq:PageContent)[#cq:tags='marketing:interest/services' or #cq:tags='marketing:interest/product']
At the moment I would still go for XPATH, because of the better performance then SQL2.
When searching for a tag I also would avoid wildcards as they are not necessary if you are searching for an exact tagname.
Wildcards can negatively influence the performance of your query.