static function create_from_index_indice($index_indice) { // Build Solarium config from the default indexing Solr index WpSolrExtensions::require_once_wpsolr_extension(WpSolrExtensions::OPTION_INDEXES, true); $options_indexes = new OptionIndexes(); $solarium_config = $options_indexes->build_solarium_config($index_indice, null, self::DEFAULT_SOLR_TIMEOUT_IN_SECOND); return new self($solarium_config); }
public function __construct($solr_index_indice = null, $language_code = null) { // Load active extensions $this->wpsolr_extensions = new WpSolrExtensions(); $path = plugin_dir_path(__FILE__) . '../../vendor/autoload.php'; require_once $path; // Load options $this->solr_indexing_options = get_option('wdm_solr_form_data'); // Build Solarium config from the default indexing Solr index WpSolrExtensions::require_once_wpsolr_extension(WpSolrExtensions::OPTION_INDEXES, true); $options_indexes = new OptionIndexes(); $config = $options_indexes->build_solarium_config($solr_index_indice, $language_code, self::DEFAULT_SOLR_TIMEOUT_IN_SECOND); $this->index_indice = $solr_index_indice; $this->solarium_client = new Solarium\Client($config); }
function my_register_activation_hook() { /* * Migrate old data on plugin update */ WpSolrExtensions::require_once_wpsolr_extension(WpSolrExtensions::OPTION_INDEXES, true); $option_object = new OptionIndexes(); $option_object->migrate_data_from_v4_9(); }
<h4 class='head_div'>Select which Solr index will index which language</h4> <div class="wdm_note"> Each language must be stored, and queried, on it's own Solr index.<br/> - Language awareness: each language can be configured with it's own schema.xml: language specific filters, analysers, stemmers .... <br/> - Easy to understand: each schema.xml has the same stucture, except for the language specific settings <br/> - Fully featured: autocompletion and suggestions work out of the box by language <br/> - Custom: each language can have a totally custom schema.xml if necessary <br/> </div> <?php $option_indexes = new OptionIndexes(); $solr_indexes = $option_indexes->get_indexes(); $languages = $ml_plugin->get_languages(); foreach ($solr_indexes as $solr_index_indice => $solr_index) { ?> <div class="wdm_row"> <div class='col_left'> Solr index '<?php echo $solr_index['index_name']; ?> ' </div> <div class='col_right'> Is indexing: <select
function wpsolr_admin_tabs($current = 'solr_indexes') { // Get default search solr index indice WpSolrExtensions::require_once_wpsolr_extension(WpSolrExtensions::OPTION_INDEXES, true); $option_indexes = new OptionIndexes(); $default_search_solr_index = $option_indexes->get_default_search_solr_index(); $nb_indexes = count($option_indexes->get_indexes()); $are_there_indexes = $nb_indexes > 0; $tabs = array(); $tabs['solr_indexes'] = $are_there_indexes ? '1. Define your Solr Indexes' : '1. Define your Solr Index'; if ($are_there_indexes) { $tabs['solr_option'] = sprintf("2. Define your search with '%s'", !isset($default_search_solr_index) ? $are_there_indexes ? "<span class='text_error'>No index selected</span>" : '' : $option_indexes->get_index_name($default_search_solr_index)); $tabs['solr_plugins'] = '3. Define which plugins to work with'; $tabs['solr_operations'] = '4. Send your data'; } echo '<div id="icon-themes" class="icon32"><br></div>'; echo '<h2 class="nav-tab-wrapper">'; foreach ($tabs as $tab => $name) { $class = $tab == $current ? ' nav-tab-active' : ''; echo "<a class='nav-tab{$class}' href='admin.php?page=solr_settings&tab={$tab}'>{$name}</a>"; } echo '</h2>'; }
<?php /** * Included file to display admin options */ global $license_manager; WpSolrExtensions::require_once_wpsolr_extension(WpSolrExtensions::OPTION_INDEXES, true); // Options name $option_name = OptionIndexes::get_option_name(WpSolrExtensions::OPTION_INDEXES); // Options object $option_object = new OptionIndexes(); ?> <?php global $response_object, $google_recaptcha_site_key, $google_recaptcha_token; $is_submit_button_form_temporary_index = isset($_POST['submit_button_form_temporary_index']); $form_data = WpSolrExtensions::extract_form_data($is_submit_button_form_temporary_index, array('managed_solr_service_id' => array('default_value' => '', 'can_be_empty' => false))); ?> <div id="solr-hosting-tab"> <?php // Options data. Loaded after the POST, to be sure it contains the posted data. $option_data = OptionIndexes::get_option_data(WpSolrExtensions::OPTION_INDEXES); $subtabs = array(); // Create the tabs from the Solr indexes already configured foreach ($option_object->get_indexes() as $index_indice => $index) { $subtabs[$index_indice] = isset($index['index_name']) ? $index['index_name'] : 'Index with no name'; } $subtabs['new_index'] = count($option_object->get_indexes()) > 0 ? $license_manager->show_premium_link(OptionLicenses::LICENSE_PACKAGE_CORE, 'Configure another index', false) : 'Configure your first index'; // Create subtabs on the left side
<?php /** * Included file to display admin options */ WpSolrExtensions::require_once_wpsolr_extension(WpSolrExtensions::OPTION_INDEXES, true); // Options name $option_name = OptionIndexes::get_option_name(WpSolrExtensions::OPTION_INDEXES); // Options object $option_object = new OptionIndexes(); ?> <?php global $response_object, $google_recaptcha_site_key, $google_recaptcha_token; $is_submit_button_form_temporary_index = isset($_POST['submit_button_form_temporary_index']); $form_data = WpSolrExtensions::extract_form_data($is_submit_button_form_temporary_index, array('managed_solr_service_id' => array('default_value' => '', 'can_be_empty' => false))); ?> <div id="solr-hosting-tab"> <?php // Options data. Loaded after the POST, to be sure it contains the posted data. $option_data = OptionIndexes::get_option_data(WpSolrExtensions::OPTION_INDEXES); $subtabs = array(); // Create the tabs from the Solr indexes already configured foreach ($option_object->get_indexes() as $index_indice => $index) { $subtabs[$index_indice] = isset($index['index_name']) ? $index['index_name'] : 'Index with no name'; } $subtabs['new_index'] = count($option_object->get_indexes()) > 0 ? 'Configure another index' : 'Configure your first index'; // Create subtabs on the left side $subtab = wpsolr_admin_sub_tabs($subtabs);