Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Create Confluence search plugin

Deleted user February 23, 2016

I have created a custom search plugin for Confluence through the Atlassian Java SDK and it works through a macro which has an input box with the search as its action. However, I now want this search to instead replace the Confluence search rather than having to have a second search box on a page. Is this possible and if so, how do I go about doing it? Thanks!

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Adrien Ragot 2
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2016

Hi, I have some experience with the code of Confluence:

  • There are several web-sections (plugin points) in the top bar so you can certainly add your search box next to the Confluence Search;
  • If there is no web-sections for this location in the top bar, you can always use js to position your box, even if that's an ugly hack.
  • You can inject a CSS in every page to hide the Confluence search box.
  • I don't think there's any plugin point to replace all or parts of the Confluence search. The only plugin points are to extend the search index, which lets people use the Confluence search with more properties.

How you would do:

  • Read this page to find the section where you want to add your plugin: https://developer.atlassian.com/confdev/confluence-plugin-guide/confluence-plugin-module-types/web-ui-modules
  • Insert a <web-item> in your atlassian-plugin.xml. Take example on an existing plugin. You can find a lot of open-source plugins by Atlassian on BitBucket. You're probably not allowed to use a Java decompiler to look at an existing plugin's code, so don't just try to download a .jar from the Marketplace.
  • Then insert a <web-resource> paragraph to insert your JS and CSS for all pages. Use <context>atl.general</context> and <context>atl.admin</context> to embed it by default on all pages (Please check again on Answers whether those 2 contexts are enough, but that's the idea).

As a side note:

  • Search is tricky and it's hard to do better,
  • Notably, there's a difference between Confluence's Quick Search (the autocompletion which returns instant results) and the complete search page.
  • The Quick Search mixes recently viewed documents with legitimate search. It's seamless, but it's not actually a search result, and it's really hard to get it right.
  • A feature which is important to administrators is the ability to search for an administrative web item (for example "Application Links").
  • A good search requires good indexing, and to do this you need to catch every situation where a document changes, and extract the same information as Confluence does. It may not always be possible, it depends whether it's managed by public events and whether indexers are public.

If you plan on selling this plugin, I understand that there is market demand for "a better search" so it will be easy to have people try your plugin, but it will be hard to be better than the embedded search. Real people have tried improving this search, if something is still missing it's certainly because it's really hard. Last thing, there are probably much better ideas for plugins to sell once you go past the "Let's unbreak the search" phase wink

 

TAGS
AUG Leaders

Atlassian Community Events