Hello!
I have a macro that updates the body of itself on a page. Since page.setBodyContentAsString is used, the page version is kept and the new body content is not indexed in searches.
How can I trigger an update of the search index for a single page manually?
I have looked at the LuceneIndexer class, but I am unsure how to acquire the LuceneConnection it seems to require, or even if it is the right class in the first place. This is in Confluence 5.4 and 5.5.
Any ideas on which class can do what I ask?
Best regards
Nicho
Community moderators have prevented the ability to post new answers.
Hello Rodrigo,
Thank you for the link to the other thread! After poking around with ConfluenceIndexManager as suggested there, I noticed that there is also a ConfluenceIndexer which is injectable. After running confluenceIndexer.reIndex(page), I could immediately se the updated contents of the page in the search. Perhays this is a feature that has been added after that thread was created? Regardless, this seems to have fixed my problem perfectly! :)
Anyway, to give this some context, what I was creating is an excerpt and excerpt include macro where the content that is included on a page is also searchable. The workaround here is to put the excerpt into the body of the excerpt include macro, and then reindex. Also, a cool note: This works even if the bodytype is set to none, thus hiding the inserted body from anyone who edits the page!
If immediate indexing is not required the other way to do it is to use ConfluenceIndexManager:
confluenceIndexManager.getTaskQueue().enqueue(new IndexTaskFactory().createUpdateDocumentTask(page));
(This seems to adhere to the queue, and is probably better if immediate searching is not required, but correct me if I am wrong).
Best regards
Nicho
Hi Nicho,
I've investigated this possibility and it seems that confluence doesn't provide this functionality for single pages as we can see in this answer.
According the answer, you'll have some problem if you try the workaround provided.
regards,
Rodrigo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.