function _updateFindBarWithMatchInfo(state, matchRange, searchBackwards) {
        // Bail if there is no result set.
        if (!state.foundAny) {
            return;
        }

        if (findBar) {
            if (state.matchIndex === -1) {
                state.matchIndex = _.findIndex(state.resultSet, matchRange);
            } else {
                state.matchIndex = searchBackwards ? state.matchIndex - 1 : state.matchIndex + 1;
                // Adjust matchIndex for modulo wraparound
                state.matchIndex = (state.matchIndex + state.resultSet.length) % state.resultSet.length;

                // Confirm that we find the right matchIndex. If not, then search
                // matchRange in the entire resultSet.
                if (!_.isEqual(state.resultSet[state.matchIndex], matchRange)) {
                    state.matchIndex = _.findIndex(state.resultSet, matchRange);
                }
            }

            console.assert(state.matchIndex !== -1);
            if (state.matchIndex !== -1) {
                // Convert to 1-based by adding one before showing the index.
                findBar.showFindCount(StringUtils.format(Strings.FIND_MATCH_INDEX,
                                                        state.matchIndex + 1, state.resultSet.length));
            }
        }
    }
@private
Show the current match index by finding matchRange in the resultSet stored
in the search state if this is the first call for a new search query. For
subsequent calls, just compare matchRange with the next match in the resultSet
based on the search direction and show the next match if they are the same.
If not, then find the match index by searching matchRange in the entire resultSet.

@param {!SearchState} state The search state that has the array of search result
@param {!{from: {line: number, ch: number}, to: {line: number, ch: number}}} matchRange - the range of current match
@param {!boolean} searchBackwards true if searching backwards