<commit_before>package org.eclipse.recommenders.codesearch.rcp.index.indexer.utils;

import java.util.Map;

import org.apache.lucene.document.Field.Index;
import org.apache.lucene.document.Field.Store;
import org.eclipse.recommenders.codesearch.rcp.index.Fields;

import com.google.common.collect.Maps;

/**
 * Simple non dynamic version that uses a hard-coded information set for some
 * predefined fields
 */
public class SimpleNameBasedStrategy implements IFieldIndexingStrategy {

    private Map<String, Store> storeMap = Maps.newHashMap();
    private Map<String, Index> indexMap = Maps.newHashMap();

    private Object helperObj = null;

    public SimpleNameBasedStrategy() {
        // Extend by filling the two maps...

        storeMap.put(Fields.FULL_TEXT, Store.NO);
    }

    @Override
    public Store getStore(String fieldName) {
        return getValueOrDefault(fieldName, storeMap, Store.YES);
    }

    @Override
    public Index getIndex(String fieldName) {
        return getValueOrDefault(fieldName, indexMap, Index.ANALYZED);
    }

    @SuppressWarnings("unchecked")
    private <T> T getValueOrDefault(String fieldName, Map<String, T> map, T defaultValue) {
        helperObj = map.get(fieldName);

        if (helperObj != null)
            return (T) helperObj;

        return defaultValue;
    }
}<commit_msg>[indexer] default indexing behaviour is now STORE.NO; some exceptions added<commit_after>package org.eclipse.recommenders.codesearch.rcp.index.indexer.utils;

import java.util.Map;

import org.apache.lucene.document.Field.Index;
import org.apache.lucene.document.Field.Store;
import org.eclipse.recommenders.codesearch.rcp.index.Fields;

import com.google.common.collect.Maps;

/**
 * Simple non dynamic version that uses a hard-coded information set for some
 * predefined fields
 */
public class SimpleNameBasedStrategy implements IFieldIndexingStrategy {

    private Map<String, Store> storeMap = Maps.newHashMap();
    private Map<String, Index> indexMap = Maps.newHashMap();

    private Object helperObj = null;

    public SimpleNameBasedStrategy() {
        // Extend by filling the two maps...

        storeMap.put(Fields.TYPE, Store.YES);
        storeMap.put(Fields.TIMESTAMP, Store.YES);
        storeMap.put(Fields.VARIABLE_NAME, Store.YES);
        storeMap.put(Fields.QUALIFIED_NAME, Store.YES);
        storeMap.put(Fields.DECLARING_TYPE, Store.YES);
        storeMap.put(Fields.JAVA_ELEMENT_HANDLE, Store.YES);
        storeMap.put(Fields.PARAMETER_TYPES_STRUCTURAL, Store.YES);
    }

    @Override
    public Store getStore(String fieldName) {
        return getValueOrDefault(fieldName, storeMap, Store.NO);
    }

    @Override
    public Index getIndex(String fieldName) {
        return getValueOrDefault(fieldName, indexMap, Index.ANALYZED);
    }

    @SuppressWarnings("unchecked")
    private <T> T getValueOrDefault(String fieldName, Map<String, T> map, T defaultValue) {
        helperObj = map.get(fieldName);

        if (helperObj != null)
            return (T) helperObj;

        return defaultValue;
    }
}
{'fraction_non_alphanumeric': 0.10110174983797797, 'fraction_numerical': 0.0, 'mean_word_length': 3.5065693430656935, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4746664', 'n_tokens_mistral': 940, 'n_tokens_neox': 904, 'n_words': 209}