我試圖做一個布爾搜索'sname:'。$ user-> name'。 OR sname:xxxxxx; ,我沒有得到任何結果,因爲sname:xxxxxx;工作正常。我甚至用查詢修改鉤子添加了mm = 1。有人可以指導我如何做到這一點。如何在apache solr中進行布爾搜索
這裏是我的代碼.....
$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;
}
進階感謝。
感謝ü的回答,但問題是不與用戶對象,問題是使用Apache Solr實現的dismax查詢生成器。 – pmarreddy
Aww無賴。我們擔心我對Apache Solr語法不太瞭解,所以我不能真正幫助。 – theunraveler