You are here

public function ElasticsearchConnectorSearchApiViewsHandlerArgumentMoreLikeThis::options_form in Elasticsearch Connector 7.2

Same name and namespace in other branches
  1. 7.5 modules/elasticsearch_connector_search_api/includes/more_like_this_handler.inc \ElasticsearchConnectorSearchApiViewsHandlerArgumentMoreLikeThis::options_form()
  2. 7 modules/elasticsearch_connector_search_api/includes/more_like_this_handler.inc \ElasticsearchConnectorSearchApiViewsHandlerArgumentMoreLikeThis::options_form()

Extend the options form a bit.

Overrides SearchApiViewsHandlerArgumentMoreLikeThis::options_form

File

modules/elasticsearch_connector_search_api/includes/more_like_this_handler.inc, line 28
Contains SearchApiViewsHandlerArgumentMoreLikeThis.

Class

ElasticsearchConnectorSearchApiViewsHandlerArgumentMoreLikeThis
Views argument handler providing a list of related items for search servers supporting the "search_api_mlt" feature.

Code

public function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $index = search_api_index_load(substr($this->table, 17));
  if ($index
    ->server()->class == 'search_api_elasticsearch_connector') {
    $form['max_query_terms'] = array(
      '#type' => 'textfield',
      '#title' => t('Max query terms'),
      '#default_value' => $this->options['max_query_terms'],
      '#element_validate' => array(
        'element_validate_integer_positive',
      ),
      '#description' => t('The maximum number of query terms that will be included in any generated query.'),
    );
    $form['min_doc_freq'] = array(
      '#type' => 'textfield',
      '#title' => t('Min doc frequency'),
      '#default_value' => $this->options['min_doc_freq'],
      '#element_validate' => array(
        'element_validate_integer_positive',
      ),
      '#description' => t('The frequency at which words will be ignored which do not occur in at least this many docs.'),
    );
    $form['min_term_freq'] = array(
      '#type' => 'textfield',
      '#title' => t('Min term frequency'),
      '#default_value' => $this->options['min_term_freq'],
      '#element_validate' => array(
        'element_validate_integer_positive',
      ),
      '#description' => t('The frequency below which terms will be ignored in the source doc.'),
    );
  }
}