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

force immediate page reindex

David Voňka June 4, 2012

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

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 6, 2012

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:

  1. Temporarily remove all current items from the indexing queue (see ConfluenceIndexManager.getTaskQueue().flushQueue())
  2. Trigger your operation that will add to the queue.
  3. Force the queue to be flushed
  4. Add all the other index tasks back on to the queue

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.

1 vote
Nicholas May 20, 2014

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.

TAGS
AUG Leaders

Atlassian Community Events