buffer.append(" where author = ?");
buffer.append(" where sort_author = ?");
    protected static int countTotalInIndex(BrowseScope scope,                                           int numberOfResults)        throws SQLException    {        int browseType = scope.getBrowseType();        // When finding Items by Author, it often happens that        // we find every single Item (eg, the Author only published        // 2 works, and we asked for 15), and so can skip the        // query.        if ((browseType == ITEMS_BY_AUTHOR_BROWSE) &&            (scope.hasNoLimit() ||             ((scope.getTotal() > numberOfResults))))            return numberOfResults;        PreparedStatement statement = null;        Object obj    = scope.getScope();        try        {            String table = BrowseTables.getTable(scope);            StringBuffer buffer = new StringBuffer()                .append("select count(")                .append(getTargetColumns(scope))                .append(") from ")                .append(table);            boolean hasWhere = false;            if (browseType == ITEMS_BY_AUTHOR_BROWSE)            {                hasWhere = true;                buffer.append(" where author = ?");            }            String connector = hasWhere ? "and" : "where";            String sql = buffer.append(getScopeClause(scope, connector))                .toString();            if (log.isDebugEnabled())                log.debug("Total sql: \"" + sql + "\"");            statement = createStatement(scope, sql);            if (browseType == ITEMS_BY_AUTHOR_BROWSE)                statement.setString(1, (String) scope.getFocus());            return getIntValue(statement);        }        finally        {            if (statement != null)                statement.close();        }    }