From d5002dd355ae0578d62f94553a5fb8607ab74c71 Mon Sep 17 00:00:00 2001
From: John Klehm
f_es: $term
\n"; +#$out .= "Verb: $verb Term: $term Hash: " . md5($term) . "
\n"; + +$indexQuery = ''; +switch($verb) +{ + case 'app': + $indexQuery = "SELECT objectId, name, type, rank FROM searchIndex WHERE hash='" . + md5($term) . "' ORDER BY name"; + break; + case 'vendor': + $indexQuery = "SELECT objectId, name, type FROM searchIndex WHERE hash='" . + md5($term) . "' AND type='" . SEARCH_INDEX_TYPE_VENDOR ."'"; + break; + default: + $indexQuery = "SELECT objectId, name, type FROM searchIndex WHERE hash='" . + md5($term) . "'"; +} + + +###DEBUG +#$out .= "Query: $indexQuery
\n"; + +$noResultsErrorMessage = "Sorry you entered: $verb/$term and I couldn't find anything to match it.
\n"; +$result = query_appdb($indexQuery, "Get matching object manager ids"); +if ($result) +{ + $matchedObjects = array('objectId' => array(), 'type' => array()); + $numResults = 0; + +###DEBUG +# while ($oRow = query_fetch_object($result)) +# { +# $out .= "Row type: " . "$oRow->type" . " ID: " . $oRow->objectId . "\n"; +# $out .= "type] . "&iId=" . "$oRow->objectId" . "\">$oRow->name\n"; +# } + + $numResults = query_num_rows($result); + if ($numResults == 1) + { + $oRow = query_fetch_object($result); + $out = file_get_contents("http://appdb.klehm.net/objectManager.php?sClass=" . + $classStrings[$oRow->type] . "&iId=" . "$oRow->objectId"); + echo $out; + exit(0); + } + else if ($numResults > 1) + { + $out .= "