function document_perform_search in Document 7
Same name and namespace in other branches
- 6 document.inc \document_perform_search()
- 8.x document.inc \document_perform_search()
2 calls to document_perform_search()
File
- ./
document.inc, line 106
Code
function document_perform_search($searchFields, $searchText, $searchYear = NULL, $searchDocType = NULL) {
$conditions = db_and();
$conditions
->condition('n.status', DOCUMENT_STATUS_PUBLISHED);
switch ($searchFields) {
case 0:
$conditions
->condition('author', '%' . $searchText . '%', 'LIKE');
break;
case 1:
$conditions
->condition('keywords', '%' . $searchText . '%', 'LIKE');
break;
case 2:
$or = db_or();
$or
->condition('keywords', '%' . $searchText . '%', 'LIKE')
->condition('author', '%' . $searchText . '%', 'LIKE');
$conditions
->condition($or);
break;
case 3:
break;
default:
die('Invalid Input');
}
if (!empty($searchYear)) {
$conditions
->condition('publish_year', $searchYear);
}
if (!empty($searchDocType) > 0) {
$conditions
->condition('d.type', '%' . $searchDocType . '%', 'LIKE');
}
return document_search_table($conditions);
}