Jeremy Newman : disable fuzzy search for the time being as the query might be causing issues with mysql

Jeremy Newman jnewman at winehq.org
Fri Feb 22 14:36:01 CST 2008


Module: appdb
Branch: master
Commit: 42bb1eb9ea8d798c95dfcd46407c8b390837ec64
URL:    http://source.winehq.org/git/appdb.git/?a=commit;h=42bb1eb9ea8d798c95dfcd46407c8b390837ec64

Author: Jeremy Newman <jnewman at codeweavers.com>
Date:   Fri Feb 22 14:35:54 2008 -0600

disable fuzzy search for the time being as the query might be causing issues with mysql
Patch Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>

---

 include/application_queue.php |    2 -
 include/util.php              |   67 -----------------------------------------
 2 files changed, 0 insertions(+), 69 deletions(-)

diff --git a/include/application_queue.php b/include/application_queue.php
index 5727a28..4a4d4bf 100644
--- a/include/application_queue.php
+++ b/include/application_queue.php
@@ -278,8 +278,6 @@ class application_queue
     {
         echo "<b>Like matches</b>\n";
         $this->displayDuplicateTable(searchForApplication($this->oApp->sName));
-        echo "<br /><b>Fuzzy matches</b>\n";
-        $this->displayDuplicateTable(searchForApplicationFuzzy($this->oApp->sName, 60));
     }
 
     function displayDuplicateTable($hResult)
diff --git a/include/util.php b/include/util.php
index 0822b3c..94da5f2 100644
--- a/include/util.php
+++ b/include/util.php
@@ -441,68 +441,6 @@ function searchForApplication($search_words)
     return $hResult;
 }
 
-function searchForApplicationFuzzy($search_words, $minMatchingPercent)
-{
-    /* cleanup search words */
-    $search_words = cleanupSearchWords($search_words);
-
-    $foundAValue = false;
-    $excludeAppIdArray = array();
-    $appIdArray = array();
-
-    /* add on all of the like matches that we can find */
-    $hResult = searchForApplication($search_words);
-    while($oRow = query_fetch_object($hResult))
-    {
-        array_push($excludeAppIdArray, $oRow->appId);
-    }
-
-    /* add on all of the fuzzy matches we can find */
-    $sQuery = "SELECT appName, appId FROM appFamily WHERE state = 'accepted'";
-    foreach ($excludeAppIdArray as $key=>$value)
-    {
-        $sQuery.=" AND appId != '".query_escape_string($value)."'";
-    }
-    $sQuery.=";";
-
-    /* capitalize the search words */
-    $search_words = strtoupper($search_words);
-
-    $hResult = query_appdb($sQuery);
-    while($oRow = query_fetch_object($hResult))
-    {
-        $oRow->appName = strtoupper($oRow->appName); /* convert the appname to upper case */
-        similar_text($oRow->appName, $search_words, $similarity_pst);
-        if(number_format($similarity_pst, 0) > $minMatchingPercent)
-        {
-            $foundAValue = true;
-            array_push($appIdArray, $oRow->appId);
-        }
-    }
-
-    if($foundAValue == false)
-        return null;
-
-    $sQuery = "SELECT * from appFamily WHERE ";
-
-    $firstEntry = true;
-    foreach ($appIdArray as $key=>$value)
-    {
-        if($firstEntry == true)
-        {
-            $sQuery.="appId='".query_escape_string($value)."'";
-            $firstEntry = false;
-        } else
-        {
-            $sQuery.=" OR appId='".query_escape_string($value)."'";
-        }
-    }
-    $sQuery.=" ORDER BY appName;";
-
-    $hResult = query_appdb($sQuery);
-    return $hResult;
-}
-
 function outputSearchTableForhResult($search_words, $hResult)
 {
     if(($hResult == null) || (query_num_rows($hResult) == 0))
@@ -584,11 +522,6 @@ function perform_search_and_output_results($search_words)
     echo "<center><b>Like matches</b></center>";
     $hResult = searchForApplication($search_words);
     outputSearchTableForhResult($search_words, $hResult);
-
-    $minMatchingPercent = 60;
-    echo "<center><b>Fuzzy matches - minimum ".$minMatchingPercent."% match</b></center>";
-    $hResult = searchForApplicationFuzzy($search_words, $minMatchingPercent);
-    outputSearchTableForhResult($search_words, $hResult);
 }
 
 function display_page_range($iCurrentPage=1, $iPageRange=1, $iTotalPages=1, $sLinkurl=NULL)




More information about the wine-cvs mailing list