我试图做一个布尔搜索'sname:'.$user->name。' 或姓名:xxxxxx;,我没有得到任何结果,如 sname:xxxxxx; 工作正常。我什至在查询修改钩子中添加了 mm=1。有人可以指导我如何做到这一点。
这是我的代码......
$keys = "";
$filters = 'sname:'.$user->name.' OR sname:xxxxxx;
//print($filters);
$solrsort = variable_get('apachesolr_search_taxonomy_sort', 'created desc');
$page = isset($_GET['page']) ? $_GET['page'] : 0;
$_GET['retain-filters'] = 1;
try {
//stolen from search.module (search_data)
$data = apachesolr_search_execute($keys, $filters, $solrsort, 'search/apachesolr_search', $page);
$results = theme('search_results', $data, $type);
} catch (Exception $e){
watchdog('apachesolr', t('Error running search'));
}
function reports_apachesolr_modify_query(&$query, &$params, $caller) {
// I only want to see articles by the admin!
$params['mm'] = 1;
}
进阶谢谢。