How to use custom developed content property in cql?

Hi,

I am trying to create content property for storing some value on page creation. I’m able to create it but not able to use it into cql functionality.

I’m referring this blog.:https://blog.developer.atlassian.com/confluence-5-7-apis/

I have added following indexed schema in plugin.xml

<content-property-index-schema key=“myindex-schema-module-key”> <key property-key=“approval-plugin-data”> <extract path=“approver” type=“string” /> <extract path=“approval-date” type=“date” /> </key> </content-property-Preformatted textindex-schema>

And, adding property by following ways:

Content content = contentService.find().withId(ContentId.valueOf(“1234”)).fetchOneOrNull();
JsonContentProperty property = JsonContentProperty.builder()
.content(content) .key(“approval-plugin-data”) .value(new JsonString("{“approver”:“mjones”, “approval-date”:“2015-01-24”}")).build();
contentPropertyService.create(property);

I was able to fetch the page content property using REST call.

/rest/api/content/{id}/property/

It will show me page property whatever I added in java class.

but its not working inCQL.

content.property[approval-plugin-data].approval-date > now(-7d)

it returning no result found !!!

1 Like

Hi,

did you get this working?

  • Did you try to rebuild the search index? In General Configuration > Content Indexing

My question to you: How did you test this CQL statement. I’m using the REST Api but I get “Could not parse cql : content.property…” - I’m URL-encoding the search string but no success

GET http://localhost:1990/confluence/rest/api/content/search?cql=content.property%5Bmykey%5D.myId%20%3D%20%22ABC%22

Greetings