@@ -312,6 +312,39 @@ public boolean hasValue(final int docId)
312312 return requireDense ().hasValue (docId );
313313 }
314314
315+ /**
316+ * Returns a fresh {@link NumHisto} bound to this field's coordinate system,
317+ * with the document-count channel pre-attached by reference.
318+ *
319+ * <p>
320+ * Builds the dense cache on first call; idempotent thereafter. Each call
321+ * returns a new {@link NumHisto} instance, but the three arrays it carries
322+ * — {@link NumHisto#docValues}, {@link NumHisto#docHasValue} and the
323+ * {@link NumHisto#valueDocs()} channel — are the cached arrays
324+ * shared by every histogram produced by this field. Callers must not write
325+ * through them: a write into one histogram would corrupt every other.
326+ * </p>
327+ *
328+ * <p>
329+ * Per-request channels populated downstream — {@code valueSpans},
330+ * {@code valueTokens}, {@code valueScore} — are owned by the
331+ * returned histogram and may be mutated freely by their producers.
332+ * </p>
333+ *
334+ * @return per-request histogram assembly
335+ * @throws IOException if dense-cache construction fails
336+ * @throws IllegalStateException if the field cannot be represented as a
337+ * dense 4-byte integer cache
338+ */
339+ public NumHisto histo () throws IOException
340+ {
341+ cacheDense ();
342+ final DenseIntCache c = dense ;
343+ final NumHisto h = new NumHisto ((int ) min , (int ) max , c .docValues , c .docHasValue );
344+ h .setValueDocs (c .valueDocs );
345+ return h ;
346+ }
347+
315348 /**
316349 * Returns the global maximum value decoded from point metadata.
317350 *
0 commit comments