Skip to content

Commit 3c4efca

Browse files
committed
First draft
1 parent 8594a7d commit 3c4efca

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

common/src/java/com/github/oeuvres/alix/lucene/fluc/Fluc.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
import org.apache.lucene.index.FieldInfo;
1515
import org.apache.lucene.index.IndexOptions;
1616
import org.apache.lucene.index.IndexReader;
17-
import org.apache.lucene.index.LeafReader;
1817
import org.apache.lucene.index.LeafReaderContext;
19-
import org.apache.lucene.index.PostingsEnum;
2018
import org.apache.lucene.index.Terms;
2119
import org.apache.lucene.index.TermsEnum;
2220
import org.apache.lucene.search.DocIdSetIterator;

common/src/java/com/github/oeuvres/alix/lucene/fluc/FlucNum.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
* &mdash; {@link NumHisto#docValues}, {@link NumHisto#docHasValue} and the
323+
* {@link NumHisto#valueDocs()} channel &mdash; 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 &mdash; {@code valueSpans},
330+
* {@code valueTokens}, {@code valueScore} &mdash; 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

Comments
 (0)