From: <jon...@us...> - 2013-10-12 19:23:54
|
Revision: 48006 http://sourceforge.net/p/tikiwiki/code/48006 Author: jonnybradley Date: 2013-10-12 19:23:48 +0000 (Sat, 12 Oct 2013) Log Message: ----------- [FIX] uni-search: Converge all 3 engines to use the same scoring system (scores still very between engines - rebuild needed) Modified Paths: -------------- branches/12.x/lib/core/Search/Elastic/Index.php branches/12.x/lib/core/Search/Lucene/Index.php branches/12.x/lib/core/Search/MySql/Index.php branches/12.x/templates/searchresults-plain.tpl Modified: branches/12.x/lib/core/Search/Elastic/Index.php =================================================================== --- branches/12.x/lib/core/Search/Elastic/Index.php 2013-10-12 18:09:46 UTC (rev 48005) +++ branches/12.x/lib/core/Search/Elastic/Index.php 2013-10-12 19:23:48 UTC (rev 48006) @@ -140,7 +140,7 @@ } else { $data['_highlight'] = ''; } - + $data['score'] = round($entry->_score, 2); return $data; }, $hits->hits ); Modified: branches/12.x/lib/core/Search/Lucene/Index.php =================================================================== --- branches/12.x/lib/core/Search/Lucene/Index.php 2013-10-12 18:09:46 UTC (rev 48005) +++ branches/12.x/lib/core/Search/Lucene/Index.php 2013-10-12 19:23:48 UTC (rev 48006) @@ -202,7 +202,7 @@ $result = array(); foreach ($hits as $key => $hit) { - $res = array_merge($this->extractValues($hit->getDocument()), array('relevance' => round($hit->score, 2))); + $res = array_merge($this->extractValues($hit->getDocument()), array('score' => round($hit->score * 100))); $found = false; if (!empty($res['object_id']) && !empty($res['object_type'])) { // filter out duplicates here Modified: branches/12.x/lib/core/Search/MySql/Index.php =================================================================== --- branches/12.x/lib/core/Search/MySql/Index.php 2013-10-12 18:09:46 UTC (rev 48005) +++ branches/12.x/lib/core/Search/MySql/Index.php 2013-10-12 19:23:48 UTC (rev 48006) @@ -110,7 +110,7 @@ if ($scoreField) { $str = $this->db->qstr(implode(' ', $words)); - $selectFields['score'] = $this->table->expr("MATCH(`$scoreField`) AGAINST ($str)"); + $selectFields['score'] = $this->table->expr("ROUND(MATCH(`$scoreField`) AGAINST ($str),2)"); } $count = $this->table->fetchCount($conditions); $entries = $this->table->fetchAll($selectFields, $conditions, $resultCount, $resultStart, $order); Modified: branches/12.x/templates/searchresults-plain.tpl =================================================================== --- branches/12.x/templates/searchresults-plain.tpl 2013-10-12 18:09:46 UTC (rev 48005) +++ branches/12.x/templates/searchresults-plain.tpl 2013-10-12 19:23:48 UTC (rev 48006) @@ -32,8 +32,8 @@ (<span class="objecttype">{tr}{$result.object_type|escape}{/tr}</span>) {/if} - {if $prefs.feature_search_show_pertinence eq 'y' && !empty($result.relevance)} - <span class="itemrelevance">({tr}Relevance:{/tr} {$result.relevance|escape})</span> + {if $prefs.feature_search_show_pertinence eq 'y' and !empty($result.score)} + <span class="itemrelevance">({tr}Relevance:{/tr} {$result.score|escape})</span> {/if} {if $prefs.feature_search_show_visit_count eq 'y' and $result.visits neq null} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |