# Default maximum result size

**URL:** <https://www.ruby-forum.com/t/default-maximum-result-size/135145>\
**Category:** Ferret\
**Created:** [April 18, 2008, 12:36pm UTC](https://www.ruby-forum.com/t/default-maximum-result-size/135145 "2008-04-18T12:36:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [April 18, 2008, 12:36pm UTC](https://www.ruby-forum.com/t/default-maximum-result-size/135145/1 "2008-04-18T12:36:53Z")

</div>

Hi, I’ve got a Ferret index which I’m using through ActsAsFerret on a  
database with about 300,000 records. Searches on the index (for example  
wildcard - “A\*”) seem to be truncated at 512 results. This is a problem  
as I also pass conditions to ActiveRecord which filter this resultset  
down, often to zero results when in fact the database contains many  
records which matched the conditions but just happened to be outside the  
512 Ferret return.

I thought the solution would be setting max terms to a higher value,  
with something like - Ferret::Search::MultiTermQuery.default\_max\_terms =  
5000, however this seems to have no effect. Is there somewhere this  
value is overridden or could there be some other setting which is  
restricting the number of results returned by Ferret?

Any help or ideas would be great! Thanks!

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [April 24, 2008, 8:11am UTC](https://www.ruby-forum.com/t/default-maximum-result-size/135145/2 "2008-04-24T08:11:17Z")

</div>

On Fri, Apr 18, 2008 at 12:36:53PM +0200, Tom Castle wrote:

> 5000, however this seems to have no effect. Is there somewhere this  
> value is overridden or could there be some other setting which is  
> restricting the number of results returned by Ferret?

Yes, most probably it’s the boolean query’s max\_clauses option which  
defaults to 512.

If you’re using the QueryParser, you may pass it :max\_clauses =\> 5000  
option to globally raise this for all kinds of queries. There should  
also be a max\_clauses class method in BooleanQuery.

Cheers,  
Jens

–  
Jens Krämer  
Finkenlust 14, 06449 Aschersleben, Germany  
VAT Id DE251962952  
[http://www.jkraemer.net/](http://www.jkraemer.net/) - Blog  
[http://www.omdb.org/](http://www.omdb.org/) - The new free film database
