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.
Community moderators have prevented the ability to post new answers.
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.
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); } ... }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SearcherAction is deprecated since Confluence 5.5. Guess we should use SearchConstants.MAX_LIMIT instead?
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.