Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Syntax for lastModified doesn't appear to do what I think it should.

James Lowe
Contributor
August 11, 2021

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.

1 answer

1 accepted

0 votes
Answer accepted
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 13, 2021

Hi James,

Welcome to Atlassian Community! Thanks for joining us. smile

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

James Lowe
Contributor
August 19, 2021

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.

 

Capture1.PNG

 

Thank you again.

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 19, 2021

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

James Lowe
Contributor
August 24, 2021

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.

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 24, 2021

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  

James Lowe
Contributor
September 5, 2021

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

Like Shannon S likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events