Confluence Server: Adding new content type (and hooking it correctly into CQL and the search index)

I want to add new content type to Confluence. The name of the new type is “snippet”. Beyond the regular fields (ie: Title) it will also have a field: “keyphrase” which we want to be able to expose to CQL search.

So, we would like this to be a valid CQL clause: keyphrase = “this is the key phrase” . This clause will only retrieve snippet contents.

We also want snippets to have their own specific Icon- so, for example when they are listed in search results, they will be displayed with their own snippets.

After massive research this is my plan. I am still left with a couple of uncertainties and questions and hence posting this here for feedback:

  1. Define a new ContentType (/com/atlassian/confluence/api/model/content/ContentType) for SNIPPET
  2. Each new snippet is basically a new Content object with ContentType=SNIPPET (/com/atlassian/confluence/api/model/content/Content )
  3. Each snippet object is set with a ContentJsonProperty which hold its keyphrase information ( /com/atlassian/confluence/api/model/content/JsonContentProperty)
  4. Define in my plugin an Extractor2 module which will add the keyphrase property to the Lucene universe ( https://developer.atlassian.com/server/confluence/extractor2-module/ )
  5. Define a new CQL Field module so that that “keyphrase” would be legit CQL (https://developer.atlassian.com/server/confluence/cql-field-module/ )
  6. Whenever the keyphrase changes I need to ensure the ContentJsonProperty is updated accordingly.

Uncertainties and open questions:

  1. Creation, removal and updates (also in ContentJsonProperty ) will be indexed into the Lucense index just by virtue of the object being a Content. Or- should I actually do anything more proactively to inject the information to Lucene?
  2. I haven’t found how I can make my snippet icon be shown in the search results or anywhere else when the snippet is displayed.
  3. Am I missing another key component?
1 Like