class PostgresSchema {

    public static void search(final QueryStatement statement, final CollectionName collection, final IObject criteria)
            throws QueryBuildException {
        try {
            Writer body = statement.getBodyWriter();

            body.write("SELECT ");
            body.write(DOCUMENT_COLUMN);
            body.write(" FROM ");
            body.write(collection.toString());

            if (criteria == null) {
                SearchClauses.writeDefaultPaging(statement);
                return;
            }
            SearchClauses.writeSearchWhere(statement, criteria);
            SearchClauses.writeSearchOrder(statement, criteria);
            SearchClauses.writeSearchPaging(statement, criteria);
        } catch (Exception e) {
            throw new QueryBuildException("Failed to build search query", e);
        }
    }

    private  PostgresSchema();

}