Sha256: ea44db589fb23e5d9884e6c05f37c4a467db4a8cdb11f327af80a049ba22aced

Contents?: true

Size: 1.07 KB

Versions: 13

Compression:

Stored size: 1.07 KB

Contents

# -*- encoding : utf-8 -*-
module Blacklight::Solr
  # Pagination for facet values -- works by setting the limit to max
  # displayable. You have to ask Solr for limit+1, to get enough
  # results to see if 'more' are available'. That is, the all_facet_values
  # arg in constructor should be the result of asking solr for limit+1
  # values. 
  # This is a workaround for the fact that Solr itself can't compute
  # the total values for a given facet field,
  # so we cannot know how many "pages" there are.
  #
  class FacetPaginator < Blacklight::FacetPaginator
    # all_facet_values is a list of facet value objects returned by solr,
    # asking solr for n+1 facet values.
    # options:
    # :limit =>  number to display per page, or (default) nil. Nil means
    #            display all with no previous or next. 
    # :offset => current item offset, default 0
    # :sort => 'count' or 'index', solr tokens for facet value sorting, default 'count'. 
    def initialize(all_facet_values, arguments)
      super

      # count is solr's default
      @sort ||= 'count'
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
blacklight-5.19.2 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.19.1 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.19.0 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.18.0 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.17.2 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.17.1 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.17.0 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.16.4 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.16.3 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.16.2 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.16.1 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.16.0 app/models/blacklight/solr/facet_paginator.rb
blacklight-5.15.0 lib/blacklight/solr/facet_paginator.rb