Review counts and ratings updated near-real-time on submission
Why it matters
Rating counts and averages that update on a nightly batch job rather than in real time allow the displayed schema-org aggregateRating to diverge from the database truth for hours after a review is submitted. A listing that receives 10 new 1-star reviews after a service failure continues displaying its pre-incident 4.5-star average until the batch runs — actively misleading users making decisions based on the structured data. Data-integrity is the core taxon: the JSON-LD reviewCount fed to Google must match the actual review count at page-render time. Delayed updates also suppress Google's trust in your rating freshness, reducing the likelihood of rich-result display.
Severity rationale
High because batch-delayed rating updates allow structured data to misrepresent actual listing quality for hours, creating a data-integrity gap that Google's structured data guidelines prohibit.
Remediation
Recalculate averageRating and reviewCount synchronously in the same transaction that writes the review. Avoid recomputing from a full table scan on every submit — maintain running aggregates on the listing row.
// src/app/api/listings/[id]/reviews/route.ts
export async function POST(request: Request, { params }: { params: { id: string } }) {
const { rating, text } = await request.json();
await db.$transaction(async (tx) => {
await tx.review.create({ data: { listingId: params.id, rating, text } });
// Recompute aggregate from all reviews in the same transaction
const { _avg, _count } = await tx.review.aggregate({
where: { listingId: params.id },
_avg: { rating: true },
_count: { rating: true },
});
await tx.listing.update({
where: { id: params.id },
data: {
averageRating: parseFloat((_avg.rating ?? 0).toFixed(2)),
reviewCount: _count.rating,
dateModified: new Date(),
},
});
});
return Response.json({ ok: true });
}
The dateModified update in the same transaction ensures the JSON-LD timestamp stays current.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Listing Data & Schema Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- schema-org · AggregateRating — AggregateRating must reflect near-real-time review submissions
- schema-org · reviewCount — reviewCount must update within seconds of new review approval
Taxons
History
- 2026-04-18·v1.0.0·Initial import from directory-listing-schema·automated