Hello,
in my plugin i need to reindex a page immediatelly, not waiting for the automatic index queue flush. The reason is that the page must be available instatly in a suggestion box, which delivers suggestions based on the lucene index.
Is there a way of doing that other that putting the page in the queue and triggering flush of the complete queue ? I've been into confluence sources and played with the internal classes, had a few solutions, was certain that they would work ... but sadly, they did not.
I'd be really thankful for a snippet ...
David Vonka
Semanta
Community moderators have prevented the ability to post new answers.
The Confluence indexer does not offer a way for only individual items in the queue to be processed. You can either trigger an index of the entire queue, an index of a single batch (a certain number of items in the queue as defined by the index.queue.batch.size system property), or a complete re-index.
Any particular reason it needs to be 'immediate'? The index queue flush runs reasonably regularly (every minute or so, I think) and does a pretty good job of preudo-immediacy on average-sized instances.
If you really wanted to hack up something to do this by modifying the Confluence source, you could do something like this:
The big problems you will have to deal with here is concurrency on the queue, and the performance/memory implications of repeatedly moving things in and out of the index queue.
Actually, maybe you would be better off modifying the IndexTaskQueue implementation to be priority based, so that you could cause things with "high" priority to be inserted into the front of the queue.
I know this is an old question, but this seems to be a feature now, so I thought I'd mention it here in case anyone else has this problem. I found the after being told of this thread in relation to my own problem: https://answers.atlassian.com/questions/296801/triggering-an-update-for-the-search-index-of-a-page
Tested this on Confluence 5.4:
confluenceIndexer.reIndex(Searchable obj);
A page is searchable, for instance. ConfluenceIndexer can be injected.
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.