Index: contrib/search_api_facets/search_api_facets.entity.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/search_api/contrib/search_api_facets/Attic/search_api_facets.entity.inc,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 search_api_facets.entity.inc
--- contrib/search_api_facets/search_api_facets.entity.inc	28 Jan 2011 17:21:15 -0000	1.1.2.4
+++ contrib/search_api_facets/search_api_facets.entity.inc	4 Feb 2011 14:24:42 -0000
@@ -48,6 +48,32 @@
    */
   public function __construct(array $values = array()) {
     parent::__construct($values, 'search_api_facet');
+    // Always set default options.
+    // Since at this point, $this->options might still be a serialized string,
+    // this has to be done a bit hack-ish.
+    if (!is_array($this->options)) {
+      if ($this->options) {
+        $this->options = unserialize($this->options);
+        $was_serialized = TRUE;
+      }
+      else {
+        $this->options = array();
+      }
+    }
+    $this->options += array(
+      'limit'             => 10,
+      'display_more_link' => FALSE,
+      'more_limit'        => 10,
+      'min_count'         => 1,
+      'sort'              => 'count',
+      'missing'           => FALSE,
+      'default_true'      => TRUE,
+      'ids_list'          => array(),
+      'type'              => '',
+    );
+    if ($was_serialized) {
+      $this->options = serialize($this->options);
+    }
   }
 
   /**
@@ -57,16 +83,6 @@
    * be updated.
    */
   public function save() {
-    // Always set default options.
-    $this->options += array(
-      'limit'        => 10,
-      'min_count'    => 1,
-      'sort'         => 'count',
-      'missing'      => FALSE,
-      'default_true' => TRUE,
-      'ids_list'     => array(),
-      'type'         => '',
-    );
     if (empty($this->options['field_name'])) {
       $index = search_api_index_load($this->index_id);
       $this->options['field_name'] = isset($index->options['fields'][$this->field]['name']) ? $index->options['fields'][$this->field]['name'] : $this->field;
Index: contrib/search_api_facets/search_api_facets.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/search_api/contrib/search_api_facets/Attic/search_api_facets.theme.inc,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 search_api_facets.theme.inc
--- contrib/search_api_facets/search_api_facets.theme.inc	10 Jan 2011 12:22:13 -0000	1.1.2.4
+++ contrib/search_api_facets/search_api_facets.theme.inc	4 Feb 2011 14:24:42 -0000
@@ -7,6 +7,7 @@
  * @param array $variables
  *   An associative array containing:
  *   - terms: An array of available facet terms, as render arrays (or HTML).
+ *   - hidden: An array of available facet terms that should initially be hidden.
  *   - active: An array of active facet filters, as render arrays (or HTML).
  */
 function theme_search_api_facets_list(array $variables) {
@@ -17,6 +18,12 @@
   foreach ($variables['terms'] as $term) {
     $items[] = render($term);
   }
+  foreach ($variables['hidden'] as $term) {
+    $items[] = array(
+      'data' => render($term),
+      'class' => array('element-hidden'),
+    );
+  }
   return $items ? theme('item_list', array('items' => $items, 'attributes' => array('class' => array('search-api-facets')))) : '';
 }
 
Index: contrib/search_api_facets/search_api_facets.api.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/search_api/contrib/search_api_facets/Attic/search_api_facets.api.php,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 search_api_facets.api.php
--- contrib/search_api_facets/search_api_facets.api.php	27 Sep 2010 20:31:36 -0000	1.1.2.4
+++ contrib/search_api_facets/search_api_facets.api.php	4 Feb 2011 14:24:42 -0000
@@ -14,7 +14,8 @@
    *     with the results. The array is keyed by the unique identifier of the
    *     facet, the values are arrays with the following keys:
    *     - field: The field to construct facets for.
-   *     - limit: The maximum number of facet terms to return.
+   *     - limit: The maximum number of facet terms to return. 0 or an empty
+   *       value means no limit.
    *     - min_count: The minimum number of results a facet value has to have in
    *       order to be returned.
    *     - missing: If TRUE, a facet for all items with no value for this field
Index: contrib/search_api_facets/search_api_facets.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/search_api/contrib/search_api_facets/Attic/search_api_facets.module,v
retrieving revision 1.1.2.37
diff -u -r1.1.2.37 search_api_facets.module
--- contrib/search_api_facets/search_api_facets.module	28 Jan 2011 17:21:15 -0000	1.1.2.37
+++ contrib/search_api_facets/search_api_facets.module	4 Feb 2011 14:24:42 -0000
@@ -42,6 +42,7 @@
   $themes['search_api_facets_list'] = array(
     'variables' => array(
       'terms' => array(),
+      'hidden' => array(),
       'active' => array(),
     ),
     'file' => 'search_api_facets.theme.inc',
@@ -160,9 +161,25 @@
   $form['limit'] = array(
     '#type' => 'textfield',
     '#title' => t('Number of terms'),
-    '#description' => t('The maximum number of facet terms to be displayed in this block. Leave blank or set to 0 for no limit.'),
+    '#description' => t('The maximum number of facet terms to be initially displayed in this block. Leave blank or set to 0 for no limit.'),
     '#default_value' => $options['limit'],
   );
+  $form['display_more_link'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Display "More" link for showing additional facet terms'),
+    '#default_value' => $options['display_more_link'],
+  );
+  $form['more_limit'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Total number of terms'),
+    '#description' => t('The maximum number of facet terms to be displayed in this block after the "More" link is clicked. Leave blank or set to 0 for no limit.'),
+    '#states' => array(
+      'invisible' => array(
+        'input[name="display_more_link"]' => array('checked' => FALSE),
+      ),
+    ),
+    '#default_value' => $options['more_limit'],
+  );
   $form['min_count'] = array(
     '#type' => 'textfield',
     '#title' => t('Minimum result count'),
@@ -228,9 +245,6 @@
  * Validation function for search_api_facets_block_configure().
  */
 function search_api_facets_block_configure_validate(array $element, array &$form_state) {
-  if ($delta == 'current-search') {
-    return;
-  }
   $limit = $element['limit']['#value'];
   if ($limit && (!is_numeric($limit) || $limit < 0 || strpos($limit, '.') !== FALSE)) {
     form_error($element['limit'], t('The number of terms has to be a non-negative integer, or left blank.'));
@@ -239,6 +253,11 @@
   if (!$min_count || !is_numeric($min_count) || $min_count <= 0 || strpos($min_count, '.') !== FALSE) {
     form_error($element['min_count'], t('The minimum count has to be a positive integer.'));
   }
+  $display_more_link = $element['display_more_link']['#value'];
+  $more_limit = $element['more_limit']['#value'];
+  if ($display_more_link && $more_limit && (!is_numeric($more_limit) || $more_limit <= 0 || strpos($more_limit, '.') !== FALSE)) {
+    form_error($element['limit'], t('The total number of terms has to be a non-negative integer, or left blank.'));
+  }
 }
 
 /**
@@ -349,11 +368,15 @@
   $theme = array(
     '#theme'  => 'search_api_facets_list' . $theme_suffix,
     '#terms'  => array(),
+    '#hidden' => array(),
     '#active' => array(),
   );
 
+  $count = 0;
+  $limit = $options['limit'];
   foreach ($terms as $term) {
-    $theme['#terms'][] = array(
+    $key = ++$count > $limit ? '#hidden' : '#terms';
+    $theme[$key][] = array(
       '#theme'   => 'search_api_facets_facet' . $theme_suffix,
       '#name'    => $term->name,
       '#count'   => $term->count,
@@ -362,6 +385,9 @@
       '#active'  => FALSE,
     );
   }
+  if ($theme['#hidden']) {
+    drupal_add_js(drupal_get_path('module', 'search_api_facets') . '/search_api_facets.js');
+  }
   foreach ($active as $filter) {
     $theme['#active'][] = array(
       '#theme'   => 'search_api_facets_facet' . $theme_suffix,
@@ -578,7 +604,7 @@
     $active[$facet->delta] = $search_id;
     $fields[$facet->delta] = array(
       'field'     => $facet->field,
-      'limit'     => $facet->options['limit'],
+      'limit'     => $facet->options['display_more_link'] ? $facet->options['more_limit'] : $facet->options['limit'],
       'min_count' => $facet->options['min_count'],
       'missing'   => $facet->options['missing'],
     );
Index: contrib/search_api_facets/search_api_facets.js
===================================================================
RCS file: contrib/search_api_facets/search_api_facets.js
diff -N contrib/search_api_facets/search_api_facets.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ contrib/search_api_facets/search_api_facets.js	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,22 @@
+// $Id: search_api.admin.js,v 1.1.2.4 2010/11/07 17:24:16 drunkenmonkey Exp $
+
+(function($) {
+
+Drupal.behaviors.searchApiFacetsMore = {
+  attach: function (context, settings) {
+    $('.block-search-api-facets', context).has('ul.search-api-facets > li.element-hidden').each(function() {
+      $block = $(this);
+      $('.content', $block).append($('<a href="#" id="' + $block.attr('id') + '-more-link" class="search-api-facet-more-link">' + Drupal.t('More') + '</a>')
+        .attr('title', Drupal.t('Show additional facet terms.'))
+        .click(function() {
+          $link = $(this);
+          $('#' + $link.attr('id').replace(/-more-link$/, '') + ' li.element-hidden', context).removeClass('element-hidden');
+          $link.hide();
+          return false;
+        })
+      );
+    });
+  }
+};
+
+})(jQuery);
\ No newline at end of file
