created proper solr call for filtered search

This commit is contained in:
Bachir Soussi Chiadmi
2017-10-30 14:48:23 +01:00
parent 2f56697bb7
commit 042e111bc4
2 changed files with 89 additions and 10 deletions

View File

@@ -682,7 +682,7 @@ function materio_search_api_search_form($form, &$form_state){
// add a back to search/base home bouton if on explore/foo
if ($path == 'explore' || $path == 'bookmarks' || $path == 'lists' ) {
// buttons form container
$form['rightcol'] = array(
'#type' => 'container',
@@ -763,17 +763,17 @@ function materio_search_api_advanced_search_form($form, &$form_state){
$values = isset($form_state['values']) ? $form_state['values'] : null;
// dsm($values, "values");
$args = arg();
// dsm($args, 'args');
// get the first elemt of url args
$path = array_shift($args);
if (isset($args[0]) && $args[0] == "filters") {
$path .= '/'.array_shift($args);
}
// get the keywords from args and reconstruct the filter lines with default values
$args_values = array();
if($path == 'explore' && $args[0] !== "ajax"){
if($path == 'explore/filters' && $args[0] !== "ajax"){
$keywords = explode("+", $args[0]);
// TODO: what if a keyword contains a +
// dsm($keywords, 'keywords');
@@ -837,7 +837,7 @@ function materio_search_api_advanced_search_form($form, &$form_state){
if(strpos($trigger['#name'], 'rm-filter-') === 0){
// $form_state['filterlines'] = $form_state['filterlines']+1;
$rmline = $trigger['#return_value'];
dsm($rmline, "rmline");
// dsm($rmline, "rmline");
}
}
@@ -1057,7 +1057,7 @@ function materio_search_api_advanced_search_rmline_callback($form, &$form_state)
function materio_search_api_advanced_search_form_validate($form, &$form_state){
if($form_state['triggering_element']['#name'] == 'search'){
// dsm($form, '$form');
dsm($form_state, 'form_state');
// dsm($form_state, 'form_state');
if (!isset($form_state['values']['filter-0-1']) || $form_state['values']['filter-0-1'] == '') {
form_set_error('filters', 'Please choose at least 1 keyword.');
@@ -1091,7 +1091,7 @@ function materio_search_api_advanced_search_form_submit($form, &$form_state){
// dsm($keywords_str);
$form_state['redirect'] = 'explore/'.$keywords_str; //rawurlencode($keywords_str);
$form_state['redirect'] = 'explore/filters/'.$keywords_str; //rawurlencode($keywords_str);
}