src/search/node/FindInFilesDomain.js
function doSearch(searchObject, nextPages) {

    savedSearchObject = searchObject;
    if (!files) {
        console.log("no file object found");
        return {};
    }
    results = {};
    numMatches = 0;
    numFiles = 0;
    foundMaximum = false;
    if (!nextPages) {
        exceedsMaximum = false;
        evaluatedMatches = 0;
    }
    var queryObject = parseQueryInfo(searchObject.queryInfo);
    if (searchObject.files) {
        files = searchObject.files;
    }
    if (searchObject.getAllResults) {
        searchObject.maxResultsToReturn = MAX_TOTAL_RESULTS;
    }
    doSearchInFiles(files, queryObject.queryExpr, searchObject.startFileIndex, searchObject.maxResultsToReturn);
    if (crawlComplete && !nextPages) {
        numMatches = getNumMatches(files, queryObject.queryExpr);
    }
    var send_object = {
        "results":  results,
        "foundMaximum":  foundMaximum,
        "exceedsMaximum":  exceedsMaximum
    };

    if (!nextPages) {
        send_object.numMatches = numMatches;
        send_object.numFiles = numFiles;
    }

    if (searchObject.getAllResults) {
        send_object.allResultsAvailable = true;
    }
    return send_object;
}
function doSearch(searchObject, nextPages) {

    savedSearchObject = searchObject;
    if (!files) {
        console.log("no file object found");
        return {};
    }
    results = {};
    numMatches = 0;
    numFiles = 0;
    foundMaximum = false;
    if (!nextPages) {
        exceedsMaximum = false;
        evaluatedMatches = 0;
    }
    var queryObject = parseQueryInfo(searchObject.queryInfo);
    if (searchObject.files) {
        files = searchObject.files;
    }
    if (searchObject.getAllResults) {
        searchObject.maxResultsToReturn = MAX_TOTAL_RESULTS;
    }
    doSearchInFiles(files, queryObject.queryExpr, searchObject.startFileIndex, searchObject.maxResultsToReturn);
    if (crawlComplete && !nextPages) {
        numMatches = getNumMatches(files, queryObject.queryExpr);
    }
    var send_object = {
        "results":  results,
        "foundMaximum":  foundMaximum,
        "exceedsMaximum":  exceedsMaximum
    };

    if (!nextPages) {
        send_object.numMatches = numMatches;
        send_object.numFiles = numFiles;
    }

    if (searchObject.getAllResults) {
        send_object.allResultsAvailable = true;
    }
    return send_object;
}
function doSearch ( searchObject , nextPages ) { savedSearchObject = searchObject ; if ( ! files ) { console . log ( "no file object found" ) ; return { } ; } results = { } ; numMatches = 0 ; numFiles = 0 ; foundMaximum = false ; if ( ! nextPages ) { exceedsMaximum = false ; evaluatedMatches = 0 ; } var queryObject = parseQueryInfo ( searchObject . queryInfo ) ; if ( searchObject . files ) { files = searchObject . files ; } if ( searchObject . getAllResults ) { searchObject . maxResultsToReturn = MAX_TOTAL_RESULTS ; } doSearchInFiles ( files , queryObject . queryExpr , searchObject . startFileIndex , searchObject . maxResultsToReturn ) ; if ( crawlComplete && ! nextPages ) { numMatches = getNumMatches ( files , queryObject . queryExpr ) ; } var send_object = { "results" : results , "foundMaximum" : foundMaximum , "exceedsMaximum" : exceedsMaximum } ; if ( ! nextPages ) { send_object . numMatches = numMatches ; send_object . numFiles = numFiles ; } if ( searchObject . getAllResults ) { send_object . allResultsAvailable = true ; } return send_object ; }
Do a search with the searchObject context and return the results
@param   {Object}   searchObject
@param   {boolean} nextPages    set to true if to indicate that next page of an existing page is being fetched
@return {Object}   search results
Do a search with the searchObject context and return the results