Index: trunk/phase3/includes/SearchPostgres.php |
— | — | @@ -63,8 +63,6 @@ |
64 | 64 | ## Treat colons as word separators: |
65 | 65 | $term = preg_replace('/:/', ' ', $term); |
66 | 66 | |
67 | | - $this->searchTerms = array(); |
68 | | - $m = array(); |
69 | 67 | $searchstring = ''; |
70 | 68 | if( preg_match_all('/([-!]?)(\S+)\s*/', $term, $m, PREG_SET_ORDER ) ) { |
71 | 69 | foreach( $m as $terms ) { |
— | — | @@ -82,9 +80,6 @@ |
83 | 81 | } |
84 | 82 | else { |
85 | 83 | $searchstring .= " & $terms[2]"; |
86 | | - $safeterm = preg_replace('/\W+/', '', $terms[2]); |
87 | | - if (strlen($safeterm)) |
88 | | - $this->searchTerms[$safeterm] = $safeterm; |
89 | 84 | } |
90 | 85 | } |
91 | 86 | } |
— | — | @@ -138,6 +133,13 @@ |
139 | 134 | "AND r.rev_text_id = c.old_id AND 1=0"; |
140 | 135 | } |
141 | 136 | else { |
| 137 | + $m = array(); |
| 138 | + if( preg_match_all("/'([^']+)'/", $top, $m, PREG_SET_ORDER ) ) { |
| 139 | + foreach( $m as $terms ) { |
| 140 | + $this->searchTerms[$terms[1]] = $terms[1]; |
| 141 | + } |
| 142 | + } |
| 143 | + |
142 | 144 | $query = "SELECT page_id, page_namespace, page_title, ". |
143 | 145 | "rank($fulltext, to_tsquery('default',$searchstring),5) AS score ". |
144 | 146 | "FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " . |