<commit_before>/**
 * Copyright T <NAME>
 * 
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package lucandra;

import java.io.*;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import org.apache.cassandra.db.*;
import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.service.StorageProxy;
import org.apache.cassandra.thrift.ConsistencyLevel;
import org.apache.cassandra.thrift.InvalidRequestException;
import org.apache.cassandra.thrift.UnavailableException;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.log4j.Logger;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.Term;

public class CassandraUtils
{

    public static final Properties           properties;
    static
    {      
        try
        {
            
            properties = new Properties();
            properties.load(CassandraUtils.class.getClassLoader().getResourceAsStream("solandra.properties"));
        
        } 
        catch (FileNotFoundException e)
        {
            throw new RuntimeException("Can't locate solandra.properties file");
        }
        catch (IOException e)
        {
            throw new RuntimeException("Error reading solandra.properties file");
        }
    }
    
    
    public static final String               keySpace               = properties.getProperty("solandra.keyspace", "L");

    public static final String               termVecColumnFamily    = "TI";
    public static final String               docColumnFamily        = "Docs";
    public static final String               metaInfoColumnFamily   = "TL";
    public static final String               schemaInfoColumnFamily = "SI";

    public static final String               positionVectorKey      = "P";
    public static final String               offsetVectorKey        = "O";
    public static final String               termFrequencyKey       = "F";
    public static final String               normsKey               = "N";
    
    public static final String               schemaKey              = "S";
    public static final String               cachedCol              = "CC";
    
    public static final ByteBuffer           cachedColBytes         = ByteBufferUtil.bytes(cachedCol);
    public static final ByteBuffer           positionVectorKeyBytes = ByteBufferUtil.bytes(positionVectorKey);
    public static final ByteBuffer           offsetVectorKeyBytes   = ByteBufferUtil.bytes(offsetVectorKey);
    public static final ByteBuffer           termFrequencyKeyBytes  = ByteBufferUtil.bytes(termFrequencyKey);
    public static final ByteBuffer           normsKeyBytes          = ByteBufferUtil.bytes(normsKey);

    public static final ByteBuffer           schemaKeyBytes         = ByteBufferUtil.bytes(schemaKey);
    
    public static final List<Number>         emptyArray             = Arrays.asList(new Number[] {});
    public static final String               delimeter              = new String("\uffff");
    public static final byte[]               delimeterBytes         = ByteBufferUtil.bytes(delimeter).array();

    public static final String               finalToken             = new String("\uff<PASSWORD>");
    public static final ByteBuffer           finalTokenBytes        = ByteBufferUtil.bytes(finalToken);

    public static final String               documentMetaField      = delimeter + "META" + delimeter;
    public static final ByteBuffer           documentMetaFieldBytes = ByteBufferUtil.bytes(documentMetaField);

    public static final boolean              indexHashingEnabled    = Boolean.valueOf(System.getProperty(
            "index.hashing", "true"));
    
    public static  int                       retryAttempts             = Integer.valueOf(properties.getProperty("cassandra.retries", "1024"));
    public static  int                       retryAttemptSleep         = Integer.valueOf(properties.getProperty("cassandra.retries.sleep", "100")); 
    
    //how often to check for cache invalidation
    public static int                        cacheInvalidationInterval = Integer.valueOf(properties.getProperty("solandra.cache.invalidation.check.interval", "1000"));
  
    public static final ConsistencyLevel     consistency               = ConsistencyLevel.valueOf(properties.getProperty("solandra.consistency", ConsistencyLevel.ONE.name()));
    
    
    public static final QueryPath            metaColumnPath            = new QueryPath(CassandraUtils.docColumnFamily);<commit_msg>Properties were not correctly loaded.<commit_after>/**
 * Copyright T <NAME>
 * 
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package lucandra;

import java.io.*;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import org.apache.cassandra.db.*;
import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.service.StorageProxy;
import org.apache.cassandra.thrift.ConsistencyLevel;
import org.apache.cassandra.thrift.InvalidRequestException;
import org.apache.cassandra.thrift.UnavailableException;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.log4j.Logger;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.Term;

public class CassandraUtils
{

    public static final Properties           properties;
    public static final String               keySpace;
    public static  int                       retryAttempts;
    public static  int                       retryAttemptSleep; 
    
    //how often to check for cache invalidation
    public static int                        cacheInvalidationInterval;
  
    public static final ConsistencyLevel     consistency;
    
    
    static
    {      
        try
        {
            
			properties = new Properties();
			properties.load(CassandraUtils.class.getClassLoader().getResourceAsStream("solandra.properties"));

			keySpace = properties.getProperty("solandra.keyspace", "L");
			retryAttempts = Integer.valueOf(properties.getProperty("cassandra.retries", "1024"));
			retryAttemptSleep = Integer.valueOf(properties.getProperty("cassandra.retries.sleep", "100"));

			// how often to check for cache invalidation
			cacheInvalidationInterval = Integer.valueOf(properties.getProperty("solandra.cache.invalidation.check.interval", "1000"));

			consistency = ConsistencyLevel.valueOf(properties.getProperty("solandra.consistency", ConsistencyLevel.ONE.name()));
            
        
        } 
        catch (FileNotFoundException e)
        {
            throw new RuntimeException("Can't locate solandra.properties file");
        }
        catch (IOException e)
        {
            throw new RuntimeException("Error reading solandra.properties file");
        }
    }
    
    
     

    public static final String               termVecColumnFamily    = "TI";
    public static final String               docColumnFamily        = "Docs";
    public static final String               metaInfoColumnFamily   = "TL";
    public static final String               schemaInfoColumnFamily = "SI";

    public static final String               positionVectorKey      = "P";
    public static final String               offsetVectorKey        = "O";
    public static final String               termFrequencyKey       = "F";
    public static final String               normsKey               = "N";
    
    public static final String               schemaKey              = "S";
    public static final String               cachedCol              = "CC";
    
    public static final ByteBuffer           cachedColBytes         = ByteBufferUtil.bytes(cachedCol);
    public static final ByteBuffer           positionVectorKeyBytes = ByteBufferUtil.bytes(positionVectorKey);
    public static final ByteBuffer           offsetVectorKeyBytes   = ByteBufferUtil.bytes(offsetVectorKey);
    public static final ByteBuffer           termFrequencyKeyBytes  = ByteBufferUtil.bytes(termFrequencyKey);
    public static final ByteBuffer           normsKeyBytes          = ByteBufferUtil.bytes(normsKey);

    public static final ByteBuffer           schemaKeyBytes         = ByteBufferUtil.bytes(schemaKey);
    
    public static final List<Number>         emptyArray             = Arrays.asList(new Number[] {});
    public static final String               delimeter              = new String("\uffff");
    public static final byte[]               delimeterBytes         = ByteBufferUtil.bytes(delimeter).array();

    public static final String               finalToken             = new String("\ufffe\ufffe");
    public static final ByteBuffer           finalTokenBytes        = ByteBufferUtil.bytes(finalToken);

    public static final String               documentMetaField      = delimeter + "META" + delimeter;
    public static final ByteBuffer           documentMetaFieldBytes = ByteBufferUtil.bytes(documentMetaField);

    public static final boolean              indexHashingEnabled    = Boolean.valueOf(System.getProperty(
            "index.hashing", "true"));
    

    
    public static final QueryPath            metaColumnPath            = new QueryPath(CassandraUtils.docColumnFamily);
{'fraction_non_alphanumeric': 0.07322384538608112, 'fraction_numerical': 0.0029035477724344435, 'mean_word_length': 2.499047619047619, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1664619', 'n_tokens_mistral': 2657, 'n_tokens_neox': 2590, 'n_words': 781}