Index: trunk/extensions/SolrStore/SolrTalker.php |
— | — | @@ -135,6 +135,15 @@ |
136 | 136 | if ( strpos( $value, ':' ) !== false ) { // Value conatins a ":" ? |
137 | 137 | $parts = explode( ':', $value ); // Split the query part in key (parts[0]) and value (parts[1]) |
138 | 138 | $solrField = $this->findField( $parts[0] ); // Search for a Solr field for the key |
| 139 | + |
| 140 | + //If we have a Wildcard Search transform Query to Lowercase for a Better Matching. |
| 141 | + //Because on wildcard and fuzzy searches, no text analysis is performed on the search word |
| 142 | + //and no Analyseres get used |
| 143 | + if ( strpos( $parts[1], '*' ) !== false ) { |
| 144 | + $parts[1] = strtolower( $parts[1] ); |
| 145 | + } |
| 146 | + |
| 147 | + //If we have a solrField Match add a ':' (its the Lucene equivalent of '=' ) |
139 | 148 | if ( $solrField ) { |
140 | 149 | $queryStr = $queryStr . ' ' . $solrField . ':' . $parts[1]; |
141 | 150 | } else { |
Index: trunk/extensions/SolrStore/SpecialSolrSearch.php |
— | — | @@ -82,12 +82,12 @@ |
83 | 83 | $sk = $wgUser->getSkin (); |
84 | 84 | |
85 | 85 | |
86 | | - $wgOut->setPageTitle ( wfMsg ( 'searchFieldSets' ) ); |
87 | | - $wgOut->setHTMLTitle ( wfMsg ( 'pagetitle', wfMsg ( 'searchFieldSets-title', 'SolrSearch: Select FieldSet' ) ) ); |
| 86 | + $wgOut->setPageTitle ( wfMsg ( 'solrstore-searchFieldSets-title' ) ); |
| 87 | + $wgOut->setHTMLTitle ( wfMsg ( 'pagetitle', wfMsg ( 'solrstore-searchFieldSets-title', 'SolrSearch: Select FieldSet' ) ) ); |
88 | 88 | |
89 | 89 | $wgOut->setArticleRelated ( false ); |
90 | 90 | $wgOut->addHtml ( '<div class="solrsearch-fieldset">' ); |
91 | | - $wgOut->addHtml ( wfMsg ( 'searchFieldSets-select' ) ); |
| 91 | + $wgOut->addHtml ( wfMsg ( 'solrstore-searchFieldSets-select' ) ); |
92 | 92 | $wgOut->addHtml ( '<ul>' ); |
93 | 93 | |
94 | 94 | //TODO: If no SearchSets exist, provide a shot Manual how to create some! |
— | — | @@ -113,15 +113,15 @@ |
114 | 114 | $this->searchEngine = SearchEngine::create (); |
115 | 115 | $search = & $this->searchEngine; |
116 | 116 | $search->setLimitOffset ( $this->limit, $this->offset ); |
117 | | - |
| 117 | + |
118 | 118 | $this->setupPage ( $fieldSet ); |
119 | | - |
| 119 | + |
120 | 120 | $t = Title::newFromText ( $fieldSet->getName () ); |
121 | 121 | |
122 | | - //DO we have Title matches |
| 122 | + //Do we have Title matches |
123 | 123 | $fields = $fieldSet->getFields (); |
124 | 124 | |
125 | | - //BUILD SOLR QUERY STRING FROM DA FIELDS |
| 125 | + //Build Solr query string form the fields |
126 | 126 | if ( isset ( $fields[ 'solrsearch' ] ) ) { |
127 | 127 | $query = $fields[ 'solrsearch' ]; |
128 | 128 | } else { |
— | — | @@ -236,7 +236,7 @@ |
237 | 237 | if ( $num || $this->offset ) { |
238 | 238 | // Show the create link ahead |
239 | 239 | $this->showCreateLink ( $t ); |
240 | | - $prevnext = wfViewPrevNext ( $this->offset, $this->limit, SpecialPage::getTitleFor ( 'SolrSearch/' . $fieldSet->{'mName'} ), wfArrayToCGI ( $fieldSet->{'mFields'} ), max ( $titleMatchesNum, $textMatchesNum ) < $this->limit ); |
| 240 | + $prevnext = wfViewPrevNext ( $this->offset, $this->limit, SpecialPage::getTitleFor ( 'SolrSearch/' . $fieldSet->mName ), wfArrayToCGI ( $fieldSet->mFields ), max ( $titleMatchesNum, $textMatchesNum ) < $this->limit ); |
241 | 241 | //$wgOut->addHTML( "<p class='mw-search-pager-top'>{$prevnext}</p>\n" ); |
242 | 242 | wfRunHooks ( 'SpecialSolrSearchResults', array ( $fieldSet, &$titleMatches, &$textMatches ) ); |
243 | 243 | } else { |
— | — | @@ -301,12 +301,12 @@ |
302 | 302 | /** |
303 | 303 | * |
304 | 304 | */ |
305 | | - protected function setupPage ( $fieldSet ) { |
| 305 | + protected function setupPage ( $fieldSet, $results = false ) { |
306 | 306 | global $wgOut; |
307 | 307 | |
308 | 308 | if ( !empty ( $fieldSet ) ) { |
309 | | - $wgOut->setPageTitle ( wfMsg ( 'searchresults' ) ); |
310 | | - $wgOut->setHTMLTitle ( wfMsg ( 'pagetitle', wfMsg ( 'searchresults-title', $fieldSet->getName () ) ) ); |
| 309 | + $wgOut->setPageTitle ( wfMsg ( 'solrsearch' ) .': '. $fieldSet->getName () ); |
| 310 | + $wgOut->setHTMLTitle ( wfMsg ( 'pagetitle', wfMsg ( 'solrsearch', $fieldSet->getName () ) ) ); |
311 | 311 | } |
312 | 312 | $wgOut->setArticleRelated ( false ); |
313 | 313 | $wgOut->setRobotPolicy ( 'noindex,nofollow' ); |
— | — | @@ -320,7 +320,7 @@ |
321 | 321 | * |
322 | 322 | * @param $matches SearchResultSet |
323 | 323 | */ |
324 | | - protected function showMatches ( &$matches ) { |
| 324 | + protected function showMatches ( $matches ) { |
325 | 325 | global $wgContLang; |
326 | 326 | wfProfileIn ( __METHOD__ ); |
327 | 327 | |