Esempio n. 1
0
ini_set('display_errors', 1);
include_once "settings.php";
include_once "formInputFunctions.php";
include_once "UrlForvarder.php";
include_once "QuerySearch.php";
include_once "MetadataGetter.php";
include_once "RerankInput.php";
include_once "DateDistance.php";
include_once "AuthorsDistance.php";
include_once "ViewsDistance.php";
include_once "GPSDistance.php";
if (isset($_POST['submit'])) {
    $keywords = handleTextInput($_POST['keywords']);
    $max_results = handleIntegerInput($_POST['max_results']);
    $rerankInputs = array();
    $rerankInputs['author'] = new RerankInput(handleCheckboxInput($_POST[AUTHOR_CHECKBOX]), handleIntegerInput($_POST[AUTHOR_SCALE]), handleTextInput($_POST[AUTHOR_VALUE]));
    $rerankInputs['published'] = new RerankInput(handleCheckboxInput($_POST[PUBLISHED_CHECKBOX]), handleIntegerInput($_POST[PUBLISHED_SCALE]), handleDateInput($_POST[PUBLISHED_VALUE]));
    $rerankInputs['gps'] = new RerankInput(handleCheckboxInput($_POST[GPS_CHECKBOX]), handleIntegerInput($_POST[GPS_SCALE]), handleGpsInput($_POST[GPS_VALUE]));
    $rerankInputs['views'] = new RerankInput(handleCheckboxInput($_POST[VIEWS_CHECKBOX]), handleIntegerInput($_POST[VIEWS_SCALE]), handleIntegerInput($_POST[VIEWS_VALUE]));
    $times = array();
    $timeStart = microtime(true);
    $querySearch = new QuerySearch();
    $queryResults = $querySearch->getResults($keywords, $max_results);
    $metadataGetter = new MetadataGetter($queryResults);
    $rawMetastores = $metadataGetter->getAllMetadata();
    $rank = 0;
    $metastores = array();
    foreach ($rawMetastores as &$metastore) {
        $metastore->setOldRank(++$rank);
        $metastores[$rank] = $metastore;
    }
function handleGpsInput($input)
{
    // TODO
    return handleTextInput($input);
}