Hello, I did find https://community.atlassian.com/t5/Confluence-questions/Search-Results-Macro-to-show-content-that-has-NOT-been-modified/qaq-p/139125 which showed the limitations of the 'search' macro, and that it was not on its own sophisticated enough to qury for things that were last modified *before* a certain date. The solution was to install an app called 'CQL Search'.
However I am able to enter search parameters within a 'markup' construct e.g
{search:lastModified=365d|maxLimit=50|type=page|spacekey=CS}
and this 'seems' to be a solution of sorts. However I either do not understand how the modifiers work or there is something I am missing as I no matter whethere i use '>' or '<' I seem to get the same results.
I am trying to use this method to show me pages that have not been modified for the last year (365 days).
I have tried
{search:lastModified>365|maxLimit=50|type=page|spacekey=CS}
and
{search:lastModified<365|maxLimit=50|type=page|spacekey=CS}
(just to make sure that it really was/was not working) and both of these markups seem to generate the same content for the search.
I know this did work once as we have recently moved from a local instance to a hosted instance and now this search term which previously seems to have used '-365d' is posting an error about the syntax being incorrect (implying it has changed).
Can someone point me to where I might be going wrong?
Thank you for your time.
Hi James,
Welcome to Atlassian Community! Thanks for joining us.
You can refer to the Atlassian Developer documentation on how to use lastModified in a CQL query:
Search for content that was last modified on, before, or after a particular date (or date range).
The search results will be relative to your configured time zone (which is by default the Confluence server's time zone)
Use one of the following formats:
"yyyy/MM/dd HH:mm"
"yyyy-MM-dd HH:mm"
"yyyy/MM/dd"
"yyyy-MM-dd"
In your case, using 365 isn't valid because the CQL needs a particular date.
Here's an example of someone with a similar situation who was able to resolve it by supplying a date: Solved: API query for lastModified returns every page
I hope that helps! Let me know if you have any trouble.
Take care,
Shannon
Hello Shannon, that helps a lot - thank you!
At least I understand the syntax better than I did before. A follow up question if I may? That the CQL syntax is suported in a 'markup' construct on a page, e.g. just pasting the query in the 'insert markup' macro. See attached for where I mean.
Thank you again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi James,
I can certainly try to help. I've never inserted CQL in Markup before; what are you trying to accomplish here exactly? Are you inserting a particular macro?
I hope to hear from you soon!
Shannon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Shannon, again thanks for your time.
What I am trying to is I think quite crude but effective.
Before we moved to our current hosted version of Confluence from our self-hosted older version (I don't know the numbers) the home page of this space I am interested in had what looked like a single one line query, created using markup, which confluence seems to turn into a 'macro' (as if it had been added as a search macro).
The query in this markup simply listed all pages in the same space that had not been modified for over a year - this allowed us to always be able to see which pages might need an update (or even deleted) because of their age without having to make a manual search using these often esoteric query language params.
Since the upgrade however this 'markup-cum-macro' now reports
Error rendering macro 'search' : Invalid date period: -365d.
So whatever the syntax was 'then' is not valid now.
Unfortuately it seems I cannot see what the original markup was as it gets converted to a macro 'as if' I had instered a 'search' macro directly from the built-in ones available to us.
Even though I can edit this macro directly, I cannot seem to create a query that does what I want - list only those pages that have been un-edited/last-updted for over a year.
I thought therefore I could try to just insert a new markup with a query and be done.
It has turned out a bit more complicated than I thought.
Sorry if this is something really obvious but I am just a general user with some access to edit pages and was trying to fix this myself.
I hope this makes more sense.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi James,
Thank you for providing those details. It looks like you were using the Search Results macro on your self-hosted version. Unfortunately, we ended support for that macro after Confluence 7.0, so this is why the markup syntax doesn't work anymore.
I discovered we have a feature request for that macro in Cloud:
I'm not aware of a workaround for this, but it looks like you may be able to use an add-on for that, such as Search Results for Confluence.
I hope that helps, but let me know if you have any additional questions.
Take care,
Shannon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Shannon, that was helpful - even if it didn't help me immediately resolve the issue (I am a mere minion in my org with regard to administrating and managing our confluence install so I won't be able to implement the add-on suggested personally but will let those higher-up than I know) andI have at least put my interest (vote) in that FR and encourage anyone else reading this to do so as well.
The last update to that FR was Oct 2020 so I hope my addition bumps it up even if just a tiny bit.
Have fun and stay safe.
James
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.