src/search/node/FindInFilesDomain.js
function setResults(fullpath, resultInfo, maxResultsToReturn) {
    if (results[fullpath]) {
        numMatches -= results[fullpath].matches.length;
        delete results[fullpath];
    }

    if (foundMaximum || !resultInfo || !resultInfo.matches || !resultInfo.matches.length) {
        return;
    }

    // Make sure that the optional `collapsed` property is explicitly set to either true or false,
    // to avoid logic issues later with comparing values.
    resultInfo.collapsed = collapseResults;

    results[fullpath] = resultInfo;
    numMatches += resultInfo.matches.length;
    evaluatedMatches += resultInfo.matches.length;
    maxResultsToReturn = maxResultsToReturn || MAX_RESULTS_TO_RETURN;
    if (numMatches >= maxResultsToReturn || evaluatedMatches > MAX_TOTAL_RESULTS) {
        foundMaximum = true;
    }
}
function setResults(fullpath, resultInfo, maxResultsToReturn) {
    if (results[fullpath]) {
        numMatches -= results[fullpath].matches.length;
        delete results[fullpath];
    }

    if (foundMaximum || !resultInfo || !resultInfo.matches || !resultInfo.matches.length) {
        return;
    }

    // Make sure that the optional `collapsed` property is explicitly set to either true or false,
    // to avoid logic issues later with comparing values.
    resultInfo.collapsed = collapseResults;

    results[fullpath] = resultInfo;
    numMatches += resultInfo.matches.length;
    evaluatedMatches += resultInfo.matches.length;
    maxResultsToReturn = maxResultsToReturn || MAX_RESULTS_TO_RETURN;
    if (numMatches >= maxResultsToReturn || evaluatedMatches > MAX_TOTAL_RESULTS) {
        foundMaximum = true;
    }
}
function setResults ( fullpath , resultInfo , maxResultsToReturn ) { if ( results [ fullpath ] ) { numMatches -= results [ fullpath ] . matches . length ; delete results [ fullpath ] ; } if ( foundMaximum || ! resultInfo || ! resultInfo . matches || ! resultInfo . matches . length ) { return ; } // Make sure that the optional `collapsed` property is explicitly set to either true or false, // to avoid logic issues later with comparing values. resultInfo . collapsed = collapseResults ; results [ fullpath ] = resultInfo ; numMatches += resultInfo . matches . length ; evaluatedMatches += resultInfo . matches . length ; maxResultsToReturn = maxResultsToReturn || MAX_RESULTS_TO_RETURN ; if ( numMatches >= maxResultsToReturn || evaluatedMatches > MAX_TOTAL_RESULTS ) { foundMaximum = true ; } }
Sets the list of matches for the given path, removing the previous match info, if any, and updating
the total match count. Note that for the count to remain accurate, the previous match info must not have
been mutated since it was set.
@param {string} fullpath Full path to the file containing the matches.
@param {!{matches: Object, collapsed: boolean=}} resultInfo Info for the matches to set:
matches - Array of matches, in the format returned by FindInFiles.getSearchMatches()
collapsed - Optional: whether the results should be collapsed in the UI (default false).
Sets the list of matches for the given path removing the previous match info if any and updating the total match count . Note that for the count to remain accurate the previous match info must not have been mutated since it was set .