<commit_before>package org.carrot2.source.lucene;

import java.io.IOException;
import java.util.IdentityHashMap;

import org.apache.log4j.Logger;
import org.apache.lucene.analysis.*;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.*;
import org.apache.lucene.store.*;
import org.carrot2.core.*;
import org.carrot2.core.attribute.*;
import org.carrot2.source.SearchEngineResponse;
import org.carrot2.source.SimpleSearchEngine;
import org.carrot2.util.ExceptionUtils;
import org.carrot2.util.attribute.*;
import org.carrot2.util.attribute.constraint.ImplementingClasses;

import com.google.common.collect.Maps;

/**
 * A {@link DocumentSource} fetching {@link Document}s from a local Apache Lucene index.
 * The index should be binary-compatible with the Lucene version actually imported by this
 * plugin.
 */
@Bindable(prefix = "LuceneDocumentSource")
public final class LuceneDocumentSource extends SimpleSearchEngine
{
    /** Logger for this class. */
    private final static Logger logger = Logger.getLogger(LuceneDocumentSource.class);

    /**
     * Search index {@link Directory}. Must be unlocked for reading. 
     *
     * @label Index directory
     * @group Index properties
     * @level Basic
     */
    @Input
    @Attribute
    @Init
    @Processing
    @ImplementingClasses(classes =
    {
        RAMDirectory.class, FSDirectory.class
    }, strict = false)
    public Directory directory;

    /**
     * {@link Analyzer} used at indexing time. The same analyzer should be used for
     * querying.
     * 
     * @label Analyzer
     * @group Index properties
     * @level Medium
     */
    @Input
    @Init
    @Processing
    @Required
    @Attribute
    @ImplementingClasses(classes =
    {
        SimpleAnalyzer.class, StandardAnalyzer.class, WhitespaceAnalyzer.class
    }, strict = false)
    public Analyzer analyzer = new StandardAnalyzer();<commit_msg>Commented out attributes that cause an exception on load right now.<commit_after>package org.carrot2.source.lucene;

import java.io.IOException;
import java.util.IdentityHashMap;

import org.apache.log4j.Logger;
import org.apache.lucene.analysis.*;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.*;
import org.apache.lucene.store.*;
import org.carrot2.core.*;
import org.carrot2.core.attribute.*;
import org.carrot2.source.SearchEngineResponse;
import org.carrot2.source.SimpleSearchEngine;
import org.carrot2.util.ExceptionUtils;
import org.carrot2.util.attribute.*;
import org.carrot2.util.attribute.constraint.ImplementingClasses;

import com.google.common.collect.Maps;

/**
 * A {@link DocumentSource} fetching {@link Document}s from a local Apache Lucene index.
 * The index should be binary-compatible with the Lucene version actually imported by this
 * plugin.
 */
@Bindable(prefix = "LuceneDocumentSource")
public final class LuceneDocumentSource extends SimpleSearchEngine
{
    /** Logger for this class. */
    private final static Logger logger = Logger.getLogger(LuceneDocumentSource.class);

    /**
     * Search index {@link Directory}. Must be unlocked for reading. 
     *
     * @label Index directory
     * @group Index properties
     * @level Basic
     */
    @Input
    @Attribute
    @Init
    @Processing
    // TODO: uncomment when Controller#init() is fixed.
    // @Required
    @ImplementingClasses(classes =
    {
        RAMDirectory.class, FSDirectory.class
    }, strict = false)
    public Directory directory;

    /**
     * {@link Analyzer} used at indexing time. The same analyzer should be used for
     * querying.
     * 
     * @label Analyzer
     * @group Index properties
     * @level Medium
     */
    @Input
    @Init
    @Processing
    @Required
    @Attribute
    @ImplementingClasses(classes =
    {
        SimpleAnalyzer.class, StandardAnalyzer.class, WhitespaceAnalyzer.class
    }, strict = false)
    public Analyzer analyzer = new StandardAnalyzer();
{'fraction_non_alphanumeric': 0.09855141296604132, 'fraction_numerical': 0.004274519116599383, 'mean_word_length': 3.5782608695652174, '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': '4643795', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1179, 'n_words': 308}