function doSearch (query, res) {
    if (query == {}) return {};
    else {
        console.log(query);
        var criteriaStrings = [];
        query.criteria.forEach(function(elem) {
            if (elem.criterion == 'artist') {
                criteriaStrings.push("vid_artist=\"" + elem.value + "\"");
            }
            else if (elem.criterion == 'raga') {
                criteriaStrings.push("vid_raga=\"" + elem.value + "\"");
            }
            else if (elem.criterion == 'instrument') {
                criteriaStrings.push("vid_instrument=\"" + elem.value + "\"");
            }
            else if (elem.criterion == 'decade') {
                criteriaStrings.push("vid_decade=\"" + elem.value + "\"");
            }
        });
        var queryString = "SELECT * from ytvids where " + criteriaStrings.join(" and ");
        var db = new sqlite3.Database(file, sqlite3.OPEN_READONLY);
        db.serialize(function() {
            db.all(queryString, function (err, rows) {
                res.json(rows);
            });
        });

        db.close();
    }
}
/**
 * Execute video search and send out response
 *
 * @param query json object sent in request
 * @param res http response object
 *
 * @todo This needs to process a query having any or all fields
*/
Execute video search and send out response
@param query json object sent in request
@param res http response object

@todo This needs to process a query having any or all fields
Execute video search and send out response @param query json object sent in request @param res http response object @todo This needs to process a query having any or all fields
function doSearch (query, res) {
    if (query == {}) return {};
    else {
        console.log(query);
        var criteriaStrings = [];
        query.criteria.forEach(function(elem) {
            if (elem.criterion == 'artist') {
                criteriaStrings.push("vid_artist=\"" + elem.value + "\"");
            }
            else if (elem.criterion == 'raga') {
                criteriaStrings.push("vid_raga=\"" + elem.value + "\"");
            }
            else if (elem.criterion == 'instrument') {
                criteriaStrings.push("vid_instrument=\"" + elem.value + "\"");
            }
            else if (elem.criterion == 'decade') {
                criteriaStrings.push("vid_decade=\"" + elem.value + "\"");
            }
        });
        var queryString = "SELECT * from ytvids where " + criteriaStrings.join(" and ");
        var db = new sqlite3.Database(file, sqlite3.OPEN_READONLY);
        db.serialize(function() {
            db.all(queryString, function (err, rows) {
                res.json(rows);
            });
        });
        db.close();
    }
}
function doSearch ( query , res ) { if ( query == { } ) return { } ; else { console . log ( query ) ; var criteriaStrings = [ ] ; query . criteria . forEach ( function ( elem ) { if ( elem . criterion == 'artist' ) { criteriaStrings . push ( "vid_artist=\"" + elem . value + "\"" ) ; } else if ( elem . criterion == 'raga' ) { criteriaStrings . push ( "vid_raga=\"" + elem . value + "\"" ) ; } else if ( elem . criterion == 'instrument' ) { criteriaStrings . push ( "vid_instrument=\"" + elem . value + "\"" ) ; } else if ( elem . criterion == 'decade' ) { criteriaStrings . push ( "vid_decade=\"" + elem . value + "\"" ) ; } } ) ; var queryString = "SELECT * from ytvids where " + criteriaStrings . join ( " and " ) ; var db = new sqlite3 . Database ( file , sqlite3 . OPEN_READONLY ) ; db . serialize ( function ( ) { db . all ( queryString , function ( err , rows ) { res . json ( rows ) ; } ) ; } ) ; db . close ( ) ; } }
Execute video search and send out response
 @param query json object sent in request
 @param res http response object
Execute video search and send out response @param query json object sent in request @param res http response object