Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/search/views_handler_argument_search.inc | ||
---|---|---|
13 | 13 |
class views_handler_argument_search extends views_handler_argument { |
14 | 14 |
|
15 | 15 |
/** |
16 |
* Take sure that parseSearchExpression is runned and everything is set up for it.
|
|
16 |
* Take sure that parseSearchExpression is runned and everything is set up. |
|
17 | 17 |
* |
18 |
* @param $input |
|
18 |
* @param string $input
|
|
19 | 19 |
* The search phrase which was input by the user. |
20 | 20 |
*/ |
21 |
function query_parse_search_expression($input) { |
|
21 |
public function query_parse_search_expression($input) {
|
|
22 | 22 |
if (!isset($this->search_query)) { |
23 | 23 |
$this->search_query = db_select('search_index', 'i', array('target' => 'slave'))->extend('viewsSearchQuery'); |
24 | 24 |
$this->search_query->searchExpression($input, $this->view->base_table); |
... | ... | |
29 | 29 |
/** |
30 | 30 |
* Add this argument to the query. |
31 | 31 |
*/ |
32 |
function query($group_by = FALSE) { |
|
32 |
public function query($group_by = FALSE) {
|
|
33 | 33 |
$required = FALSE; |
34 | 34 |
$this->query_parse_search_expression($this->argument); |
35 | 35 |
if (!isset($this->search_query)) { |
... | ... | |
51 | 51 |
|
52 | 52 |
$search_condition = db_and(); |
53 | 53 |
|
54 |
// Create a new join to relate the 'search_total' table to our current 'search_index' table. |
|
55 |
$join = new views_join; |
|
54 |
// Create a new join to relate the 'search_total' table to our current |
|
55 |
// 'search_index' table. |
|
56 |
$join = new views_join(); |
|
56 | 57 |
$join->construct('search_total', $search_index, 'word', 'word'); |
57 | 58 |
$search_total = $this->query->add_relationship('search_total', $join, $search_index); |
58 | 59 |
|
... | ... | |
70 | 71 |
$search_dataset = $this->query->add_table('search_dataset'); |
71 | 72 |
$conditions = $this->search_query->conditions(); |
72 | 73 |
$condition_conditions =& $conditions->conditions(); |
73 |
foreach ($condition_conditions as $key => &$condition) {
|
|
74 |
foreach ($condition_conditions as $key => &$condition) { |
|
74 | 75 |
// Take sure we just look at real conditions. |
75 | 76 |
if (is_numeric($key)) { |
76 | 77 |
// Replace the conditions with the table alias of views. |
... | ... | |
97 | 98 |
$this->query->add_having_expression(0, "COUNT(*) >= $placeholder", array($placeholder => $matches)); |
98 | 99 |
} |
99 | 100 |
} |
101 |
|
|
100 | 102 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules