solr multicore
Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
parent
fc0253d9c2
commit
c3f366a045
@ -9,19 +9,24 @@ function materio_search_api_settings(){
|
||||
$index_options[$index->machine_name] = $index->name;
|
||||
}
|
||||
|
||||
$form['mainsearchindex'] = array(
|
||||
'#type'=>'select',
|
||||
'#options'=>$index_options,
|
||||
'#default_value' => variable_get('mainsearchindex', -1),
|
||||
'#title' => t('Main search api index'),
|
||||
);
|
||||
$languages = locale_language_list();
|
||||
// dsm($languages, 'languages');
|
||||
|
||||
foreach ($languages as $lcode => $name) {
|
||||
$form['mainsearchindex_'.$lcode] = array(
|
||||
'#type'=>'select',
|
||||
'#options'=>$index_options,
|
||||
'#default_value' => variable_get('mainsearchindex_'.$lcode, -1),
|
||||
'#title' => t('Main search api index for %lang contents.', array('%lang'=>$name)),
|
||||
);
|
||||
|
||||
$form['autocompletesearchindex'] = array(
|
||||
'#type'=>'select',
|
||||
'#options'=>$index_options,
|
||||
'#default_value' => variable_get('autocompletesearchindex', -1),
|
||||
'#title' => t('Autocomplete search api index'),
|
||||
);
|
||||
$form['autocompletesearchindex_'.$lcode] = array(
|
||||
'#type'=>'select',
|
||||
'#options'=>$index_options,
|
||||
'#default_value' => variable_get('autocompletesearchindex_'.$lcode, -1),
|
||||
'#title' => t('Autocomplete search api index for %lang contents.', array('%lang'=>$name)),
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: select the activated viewmodes for change view mode and selected view mode
|
||||
$entity_infos = entity_get_info();
|
||||
|
@ -104,7 +104,12 @@ function materio_search_api_entity_property_info_alter(&$info){
|
||||
'getter callback'=>'materio_search_api_get_main_taxonomy_term_'.$i,
|
||||
);
|
||||
}
|
||||
|
||||
$properties['materio_search_api_taxonomy_term_'.$i] = array(
|
||||
'type'=>'taxonomy_term',
|
||||
'label'=> t('Taxonomy term after 5 mains'),
|
||||
'query callback'=>'entity_metadata_table_query',
|
||||
'getter callback'=>'materio_search_api_get_taxonomy_terms_after_5',
|
||||
);
|
||||
return $properties;
|
||||
}
|
||||
|
||||
@ -129,6 +134,18 @@ function materio_search_api_get_main_taxonomy_term_5($item){
|
||||
return materio_search_api_get_onto_term($item, 4);
|
||||
}
|
||||
|
||||
function materio_search_api_get_taxonomy_terms_after_5($item){
|
||||
if(isset($item->field_onthologie['und'])){
|
||||
$terms = array();
|
||||
foreach ($item->field_onthologie['und'] as $delta => $value) {
|
||||
if($delta>4)
|
||||
$terms[] = taxonomy_term_load($item->field_onthologie['und'][$delta]['tid']);
|
||||
}
|
||||
return $terms;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function materio_search_api_get_onto_term($item, $delta){
|
||||
// dsm($item, 'item');
|
||||
// dsm($delta, 'delta');
|
||||
|
@ -76,7 +76,8 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
|
||||
$tosearch = isset($last[2]) ? $last[2] : $typed;
|
||||
|
||||
// build the query
|
||||
$index_machine_name = variable_get('autocompletesearchindex', -1);
|
||||
global $language;
|
||||
$index_machine_name = variable_get('autocompletesearchindex_'.$language->language, -1);
|
||||
$query = search_api_query($index_machine_name);
|
||||
|
||||
// $query_filter = $query->createFilter();
|
||||
@ -114,7 +115,6 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
|
||||
|
||||
// dsm($term_matches, 'term_matches');
|
||||
// return 'debug mode of materio_search_api_autocomplete_searchapi';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,7 +156,8 @@ function materio_search_api_results_search(){
|
||||
}
|
||||
// dsm($keys, 'keys');
|
||||
|
||||
$index_machine_name = variable_get('mainsearchindex', -1);
|
||||
global $language;
|
||||
$index_machine_name = variable_get('mainsearchindex_'.$language->language, -1);
|
||||
$index = search_api_index_load($index_machine_name);
|
||||
|
||||
$indexed_bundles = $index->options['data_alter_callbacks']['search_api_alter_bundle_filter']['settings']['bundles'];
|
||||
@ -224,7 +225,7 @@ function materio_search_api_results_search(){
|
||||
/*
|
||||
TODO choose index in module settings
|
||||
*/
|
||||
$ret['results']['#index'] = search_api_index_load('materiaux_breves');
|
||||
$ret['results']['#index'] = search_api_index_load($index_machine_name);
|
||||
$ret['results']['#results'] = $results;
|
||||
|
||||
$ret['results']['#view_mode'] = $viewmode;
|
||||
|
Loading…
x
Reference in New Issue
Block a user