Search for partial app names
This commit is contained in:
committed by
Chris Morgan
parent
5fbaddd9f1
commit
88c098c83f
@@ -276,8 +276,11 @@ class application_queue
|
|||||||
|
|
||||||
function displayDuplicates()
|
function displayDuplicates()
|
||||||
{
|
{
|
||||||
echo "<b>Like matches</b>\n";
|
echo "<b>Like matches</b><br />\n";
|
||||||
$this->displayDuplicateTable(searchForApplication($this->oApp->sName));
|
$this->displayDuplicateTable(searchForApplication($this->oApp->sName));
|
||||||
|
echo "<br />\n";
|
||||||
|
echo "<b>Partial matches</b><br />\n";
|
||||||
|
$this->displayDuplicateTable(searchForApplicationPartial($this->oApp->sName));
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayDuplicateTable($hResult)
|
function displayDuplicateTable($hResult)
|
||||||
|
|||||||
@@ -412,6 +412,34 @@ function cleanupSearchWords($search_words)
|
|||||||
return $search_words;
|
return $search_words;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A common error for users is to submit a new app entry for a new app version,
|
||||||
|
such as C&C Red Alert 2 Yuri's Revenge when we already have C&C Red Alert 2.
|
||||||
|
Search for the first word in the search query */
|
||||||
|
function searchForApplicationPartial($sSearchWords)
|
||||||
|
{
|
||||||
|
$sSearchWords = cleanupSearchWords($sSearchWords);
|
||||||
|
$aWords = explode(' ', $sSearchWords);
|
||||||
|
$sSearchString = '';
|
||||||
|
|
||||||
|
for($i = 0; $i < sizeof($aWords); $i++)
|
||||||
|
{
|
||||||
|
if($i)
|
||||||
|
$sSearchString .= '%';
|
||||||
|
$sSearchString .= $aWords[$i];
|
||||||
|
if(strlen($aWords[$i]) > 4)
|
||||||
|
{
|
||||||
|
if($i < (sizeof($aWords) - 1))
|
||||||
|
$sSearchString .= ' ';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$hResult = query_parameters("SELECT * FROM appFamily WHERE state = 'accepted' AND
|
||||||
|
appName LIKE '?%'", $sSearchString);
|
||||||
|
|
||||||
|
return $hResult;
|
||||||
|
}
|
||||||
|
|
||||||
/* search the database and return a hResult from the query_appdb() */
|
/* search the database and return a hResult from the query_appdb() */
|
||||||
function searchForApplication($search_words)
|
function searchForApplication($search_words)
|
||||||
{
|
{
|
||||||
@@ -524,6 +552,10 @@ function perform_search_and_output_results($search_words)
|
|||||||
echo "<center><b>Like matches</b></center>";
|
echo "<center><b>Like matches</b></center>";
|
||||||
$hResult = searchForApplication($search_words);
|
$hResult = searchForApplication($search_words);
|
||||||
outputSearchTableForhResult($search_words, $hResult);
|
outputSearchTableForhResult($search_words, $hResult);
|
||||||
|
|
||||||
|
echo "<center><b>Partial matches</b></center>";
|
||||||
|
$hResult = searchForApplicationPartial($search_words);
|
||||||
|
outputSearchTableForhResult($search_words, $hResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_page_range($iCurrentPage=1, $iPageRange=1, $iTotalPages=1, $sLinkurl=NULL)
|
function display_page_range($iCurrentPage=1, $iPageRange=1, $iTotalPages=1, $sLinkurl=NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user