<commit_before>package com.ifactory.press.db.solr.spelling.suggest;

import java.io.IOException;

import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.search.Collector;
import org.apache.lucene.search.Scorer;
import org.apache.solr.search.EarlyTerminatingCollectorException;

/** A collector to use when you know there will be no more than one match, or you don't
 * care which match you get; terminates after finding a match.
 */
class FirstCollector extends Collector {

    private AtomicReaderContext arc;
    
    int docID = -1;
    
    public int getDocID() {
        return docID;
    }
    
    @Override
    public void setScorer(Scorer scorer) throws IOException {
    }

    @Override
    public void collect(int doc) throws EarlyTerminatingCollectorException {
        this.docID = arc.docBase + doc;
        throw new EarlyTerminatingCollectorException(1, -1);
    }

    @Override
    public void setNextReader(AtomicReaderContext context) throws IOException {
        arc = context;
    }
<commit_msg>conform to assertion regarding number scanned<commit_after>package com.ifactory.press.db.solr.spelling.suggest;

import java.io.IOException;

import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.search.Collector;
import org.apache.lucene.search.Scorer;
import org.apache.solr.search.EarlyTerminatingCollectorException;

/** A collector to use when you know there will be no more than one match, or you don't
 * care which match you get; terminates after finding a match.
 */
class FirstCollector extends Collector {

    private AtomicReaderContext arc;
    
    int docID = -1;
    
    public int getDocID() {
        return docID;
    }
    
    @Override
    public void setScorer(Scorer scorer) throws IOException {
    }

    @Override
    public void collect(int doc) throws EarlyTerminatingCollectorException {
        this.docID = arc.docBase + doc;
        throw new EarlyTerminatingCollectorException(1, 1);
    }

    @Override
    public void setNextReader(AtomicReaderContext context) throws IOException {
        arc = context;
    }

{'fraction_non_alphanumeric': 0.075177304964539, 'fraction_numerical': 0.0028368794326241137, 'mean_word_length': 3.380952380952381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1091848', 'n_tokens_mistral': 623, 'n_tokens_neox': 597, 'n_words': 175}