function fun_search_indexed_data()
{
    $ad_url = admin_url();
    // Retrieve search form page url
    $get_page_info = WPSolrSearchSolrClient::get_search_page();
    $url = get_permalink($get_page_info->ID);
    // Filter the search page url. Used for multi-language search forms.
    $url = apply_filters(WpSolrFilters::WPSOLR_FILTER_SEARCH_PAGE_URL, $url, $get_page_info->ID);
    // Load localization options
    $localization_options = OptionLocalization::get_options();
    $wdm_typehead_request_handler = !empty($_GET['nofacet']) ? 'wdm_return_solr_rows' : 'wdm_return_facet_solr_rows';
    echo "<div class='cls_search' style='width:100%'> <form action='{$url}' method='get'  class='search-frm' >";
    echo '<input type="hidden" value="' . $wdm_typehead_request_handler . '" id="path_to_fold">';
    echo '<input type="hidden" value="' . $ad_url . '" id="path_to_admin">';
    echo '<input type="hidden" value="' . WPSOLR_Global::getQuery()->get_wpsolr_query() . '" id="search_opt">';
    $ajax_nonce = wp_create_nonce("nonce_for_autocomplete");
    echo $form = '
        <div class="ui-widget">
	<input type="hidden"  id="ajax_nonce" value="' . $ajax_nonce . '">
        <input type="text" placeholder="' . OptionLocalization::get_term($localization_options, 'search_form_edit_placeholder') . '" value="' . esc_attr(WPSOLR_Global::getQuery()->get_wpsolr_query()) . '" name="search" id="search_que" class="' . WPSOLR_Option::OPTION_SEARCH_SUGGEST_CLASS_DEFAULT . ' sfl2" autocomplete="off"/>
	<input type="submit" value="' . OptionLocalization::get_term($localization_options, 'search_form_button_label') . '" id="searchsubmit" style="position:relative;width:auto">
	<input type="hidden" value="' . WPSOLR_Global::getOption()->get_search_after_autocomplete_block_submit() . '" id="is_after_autocomplete_block_submit">
	<input type="hidden" value="' . WPSOLR_Global::getQuery()->get_wpsolr_paged() . '" id="paginate">
<div style="clear:both"></div>
        </div>
        </form>';
    echo '</div>';
    echo "<div class='cls_results'>";
    if (is_page(WPSolrSearchSolrClient::_SEARCH_PAGE_SLUG)) {
        try {
            try {
                $final_result = WPSOLR_Global::getSolrClient()->display_results(WPSOLR_Global::getQuery());
            } catch (Exception $e) {
                $message = $e->getMessage();
                echo "<span class='infor'>{$message}</span>";
                die;
            }
            if ($final_result[2] == 0) {
                echo "<span class='infor'>" . sprintf(OptionLocalization::get_term($localization_options, 'results_header_no_results_found'), WPSOLR_Global::getQuery()->get_wpsolr_query()) . "</span>";
            } else {
                echo '<div class="wdm_resultContainer">
                    <div class="wdm_list">';
                // Display the sort list
                $selected_sort_values = WPSOLR_Global::getOption()->get_sortby_items_as_array();
                if (isset($selected_sort_values) && $selected_sort_values != '') {
                    $term = OptionLocalization::get_term($localization_options, 'sort_header');
                    $sort_select = "<label class='wdm_label'>{$term}</label><select class='select_field'>";
                    // Add options
                    $sort_options = WPSolrSearchSolrClient::get_sort_options();
                    foreach ($selected_sort_values as $sort_code) {
                        $sort_label = OptionLocalization::get_term($localization_options, $sort_code);
                        $selected = $sort_code === WPSOLR_Global::getQuery()->get_wpsolr_sort() ? 'selected' : '';
                        $sort_select .= "<option value='{$sort_code}' {$selected}>{$sort_label}</option>";
                    }
                    $sort_select .= "</select>";
                    echo '<div>' . $sort_select . '</div>';
                }
                // Display facets UI
                echo '<div id="res_facets">' . WPSOLR_UI_Facets::Build(WPSOLR_Data_Facets::get_data(WPSOLR_Global::getQuery()->get_filter_query_fields_group_by_name(), WPSOLR_Global::getOption()->get_facets_to_display(), $final_result[1]), $localization_options) . '</div>';
                echo '</div>
                    <div class="wdm_results">';
                if ($final_result[0] != '0') {
                    echo $final_result[0];
                }
                $ui_result_rows = $final_result[3];
                if (WPSOLR_Global::getOption()->get_search_is_display_results_info() && $ui_result_rows != 0) {
                    echo '<div class="res_info">' . $final_result[4] . '</div>';
                }
                if ($ui_result_rows != 0) {
                    $img = plugins_url('images/gif-load.gif', __FILE__);
                    echo '<div class="loading_res"><img src="' . $img . '"></div>';
                    echo "<div class='results-by-facets'>";
                    foreach ($ui_result_rows as $resarr) {
                        echo $resarr;
                    }
                    echo "</div>";
                    echo "<div class='paginate_div'>";
                    $total = $final_result[2];
                    $number_of_res = WPSOLR_Global::getOption()->get_search_max_nb_results_by_page();
                    if ($total > $number_of_res) {
                        $pages = ceil($total / $number_of_res);
                        echo '<ul id="pagination-flickr" class="wdm_ul">';
                        for ($k = 1; $k <= $pages; $k++) {
                            echo "<li ><a class='paginate' href='javascript:void(0)' id='{$k}'>{$k}</a></li>";
                        }
                    }
                    echo '</ul></div>';
                }
                echo '</div>';
                echo '</div><div style="clear:both;"></div>';
            }
        } catch (Exception $e) {
            echo sprintf('The search could not be performed. An error occured while trying to connect to the Apache Solr server. <br/><br/>%s<br/>', $e->getMessage());
        }
    }
    echo '</div>';
}
function solr_search_form()
{
    ob_start();
    // Load current theme's wpsolr search form if it exists
    $search_form_template = locate_template('wpsolr-search-engine/searchform.php');
    if ('' != $search_form_template) {
        require $search_form_template;
        $form = ob_get_clean();
    } else {
        $ad_url = admin_url();
        if (isset($_GET[WPSOLR_Query_Parameters::SEARCH_PARAMETER_Q])) {
            $search_que = $_GET[WPSOLR_Query_Parameters::SEARCH_PARAMETER_Q];
        } else {
            if (isset($_GET[WPSOLR_Query_Parameters::SEARCH_PARAMETER_SEARCH])) {
                $search_que = $_GET[WPSOLR_Query_Parameters::SEARCH_PARAMETER_SEARCH];
            } else {
                $search_que = '';
            }
        }
        // Get localization options
        $localization_options = OptionLocalization::get_options();
        $wdm_typehead_request_handler = 'wdm_return_solr_rows';
        $get_page_info = WPSolrSearchSolrClient::get_search_page();
        $ajax_nonce = wp_create_nonce("nonce_for_autocomplete");
        $url = get_permalink($get_page_info->ID);
        // Filter the search page url. Used for multi-language search forms.
        $url = apply_filters(WpSolrFilters::WPSOLR_FILTER_SEARCH_PAGE_URL, $url, $get_page_info->ID);
        $form = "<div class='cls_search' style='width:100%'><form action='{$url}' method='get'  class='search-frm2' >";
        $form .= '<input type="hidden" value="' . $wdm_typehead_request_handler . '" id="path_to_fold">';
        $form .= '<input type="hidden"  id="ajax_nonce" value="' . $ajax_nonce . '">';
        $form .= '<input type="hidden" value="' . $ad_url . '" id="path_to_admin">';
        $form .= '<input type="hidden" value="' . $search_que . '" id="search_opt">';
        $form .= '
       <div class="ui-widget search-box">
 	<input type="hidden"  id="ajax_nonce" value="' . $ajax_nonce . '">
        <input type="text" placeholder="' . OptionLocalization::get_term($localization_options, 'search_form_edit_placeholder') . '" value="' . $search_que . '" name="' . WPSOLR_Query_Parameters::SEARCH_PARAMETER_Q . '" id="search_que" class="search-field sfl1" autocomplete="off"/>
	<input type="submit" value="' . OptionLocalization::get_term($localization_options, 'search_form_button_label') . '" id="searchsubmit" style="position:relative;width:auto">
        <div style="clear:both"></div>
        </div>
	</div>
       </form>';
    }
    return $form;
}