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:
- Define a new ContentType (/com/atlassian/confluence/api/model/content/ContentType) for SNIPPET
- Each new snippet is basically a new Content object with ContentType=SNIPPET (/com/atlassian/confluence/api/model/content/Content )
- Each snippet object is set with a ContentJsonProperty which hold its keyphrase information ( /com/atlassian/confluence/api/model/content/JsonContentProperty)
- Define in my plugin an Extractor2 module which will add the keyphrase property to the Lucene universe ( Extractor2 module )
- Define a new CQL Field module so that that “keyphrase” would be legit CQL (https://developer.atlassian.com/server/confluence/cql-field-module/ )
- Whenever the keyphrase changes I need to ensure the ContentJsonProperty is updated accordingly.
Uncertainties and open questions:
- 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?
- 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.
- Am I missing another key component?