I was trying to do do a boolean search 'sname:'.$user->name.' OR sname:xxxxxx; , i am not getting any results where as sname:xxxxxx; works fine. i even added mm=1 with the query modify hook. can somebody guide me how i can accomplish this.
Here is my code.....
$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;
}
Adv thanks.
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedYou are trying to do a boolean filter query or a boolean OR keyword search?
If a filter query, look at the code in apachesolr_nodeaccess
for keywords, setting mm to 1 shoudl be enough alone.
this module does not support field:value type queries as keywords due to use of the dismax handler
Comment #2
robertDouglass CreditAttribution: robertDouglass commentedThere are two cases here, as Peter indicated. First, if you want to change the keyword behavior to be OR instead of AND you can use hook_apachesolr_modify_query(&$query, &$params, $caller) like this:
If you have a field that is a boolean field you can filter on it like this (same hook):
Comment #4
nirmal_george CreditAttribution: nirmal_george commentedComment #5
jpmckinney CreditAttribution: jpmckinney commented