#122 ✓resolved
Robert Zotter

Facet.limit doesn't work with negative numbers (unlimited number of results)

Reported by Robert Zotter | June 5th, 2010 @ 09:31 PM


There is a bug when supplying a negative number as a facet limit.

ArgumentError: negative array size (or size too big)
    from /Users/Zotter/workspace/ioffer/vendor/plugins/sunspot-1.1.0/lib/sunspot/search/query_facet.rb:56:in `first'
    from /Users/Zotter/workspace/ioffer/vendor/plugins/sunspot-1.1.0/lib/sunspot/search/query_facet.rb:56:in `sort_rows!'
    from /Users/Zotter/workspace/ioffer/vendor/plugins/sunspot-1.1.0/lib/sunspot/search/query_facet.rb:30:in `rows'
    from /Users/Zotter/workspace/ioffer/vendor/plugins/sunspot-1.1.0/lib/sunspot/search/field_facet.rb:37:in `rows'
    from (irb):28

Simple fix. Change line 55 in Sunspot::Search::QueryFacet#sort_rows! to:

if @options[:limit].to_i > 0

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Awesome Solr interaction for Ruby

People watching this ticket


Referenced by