Missed Team ’24? Catch up on announcements here.

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

Is the Lucene Query Search limited to 500 results in Confluence 5?

Manuel Kummerländer February 4, 2014

Hi,

I implemented a search function on the lucene index like (almost) this:

final ISearch search = new ContentSearch(userSearchQuery, null, null, null);
final SearchResults searchResults = searchManager.search(search);

I expect searchResults.size() to deliver a number > 500. On Confluence 5 I get exactly 500, on Confluence 4 I get the expected number of elements. I can't find any clue that the limitation is a new feature or intended or whatever. Can anybody give me a tip?

Thanks for your help!
Kind regards.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Paul Herwarth von Bittenfeld February 10, 2014

Response from Atlassian support:

In confluence 5 there is indeed a limit of 500 search results by default - you can see it in the SearcherAction class. If you want more results try using pagination.

2 votes
David Simpson • AppFusions • v3 January 12, 2015

Yes, that's unfortunate but you could overcome this with a little recursion ... 

 

...
	allResults = Lists.newArrayList();
	doSearch(0, SearcherAction.MAX_RESULTS); // SearcherAction.MAX_RESULTS = 500
	// Now use `allResults` instead of your `searchResults`
	...
 
 
    private void doSearch(int startIndex, int limit)
    {
		...
		final ISearch search = new ContentSearch(userSearchQuery, null, startIndex, limit);
		final SearchResults searchResults = searchManager.search(search);
		allResults.addAll(searchResults.getAll());

		if (results.getUnfilteredResultsCount() > (startIndex + limit))
        {
        	doSearch((startIndex + limit), limit);
        }
		...
	}
Bernd Lindner May 8, 2015

SearcherAction is deprecated since Confluence 5.5. Guess we should use SearchConstants.MAX_LIMIT instead?

TAGS
AUG Leaders

Atlassian Community Events