Index: extractor.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/extractor/extractor.module,v retrieving revision 1.2 diff -u -r1.2 extractor.module --- extractor.module 1 Mar 2010 16:31:36 -0000 1.2 +++ extractor.module 24 Mar 2010 17:06:53 -0000 @@ -46,7 +46,7 @@ $items = array(); $items['admin/settings/extractor'] = array( 'title' => 'Extractor', - 'description' => 'Set vocabulary for simple term extractor API.', + 'description' => 'Set configuration options for simple term extractor API.', 'page callback' => 'drupal_get_form', 'page arguments' => array('extractor_settings_form'), 'access callback' => 'user_access', @@ -72,9 +72,31 @@ '#options' => $options, '#default_value' => variable_get('extractor_simple_vid', 0), ); + $form['extractor_simple_termcount'] = array( + '#type' => 'textfield', + '#size' => 10, + '#maxlenght' => 10, + '#title' => t('Term count'), + '#description' => t('Enter the maximum number of terms that the extractor should handle. The default value is 2000. Be careful when raising this value. It will significantly influence performance.'), + '#default_value' => variable_get('extractor_simple_termcount', 2000), + ); return system_settings_form($form); } + +/** + * Implementation of hook_form_validate + */ +function extractor_settings_form_validate($form, &$form_state) { + if (!ctype_digit((string) $form_state['values']['extractor_simple_termcount'])) { + form_set_error('extractor_simple_termcount', t('Please enter an integer value for the term count.')); + } + if ($form_state['values']['extractor_simple_termcount'] > 2000) { + drupal_set_message(t('Please be aware that you set the term count to a very high value. This might seriously influence the performance of your site.'), 'warning'); + } +} + + /** * Main API function. * Index: libraries/extractor_simple.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/extractor/libraries/extractor_simple.inc,v retrieving revision 1.1 diff -u -r1.1 extractor_simple.inc --- libraries/extractor_simple.inc 4 Dec 2009 15:01:46 -0000 1.1 +++ libraries/extractor_simple.inc 24 Mar 2010 17:06:53 -0000 @@ -77,7 +77,7 @@ } /** - * Look up terms for a given word. Supports up to 2000 terms. + * Look up terms for a given word. Defaults to 2000 terms. */ function _extractor_simple_lookup($word) { static $term_cache = array(); @@ -89,7 +89,7 @@ } if (!$loaded) { - $result = db_query_range('SELECT tid, name FROM {term_data} WHERE vid = %d', variable_get('extractor_simple_vid', 1), 0, 2000); + $result = db_query_range('SELECT tid, name FROM {term_data} WHERE vid = %d', variable_get('extractor_simple_vid', 1), 0, variable_get('extractor_simple_termcount', 2000)); while ($term = db_fetch_object($result)) { $term_cache[strtolower($term->name[0])][$term->name] = $term; }