/*******************************************************************************
* Copyright (c) 2006-2012
* Software Technology Group, Dresden University of Technology
* DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Software Technology Group - TU Dresden, Germany;
* DevBoost GmbH - Berlin, Germany
* - initial API and implementation
******************************************************************************/
package org.reuseware.sokan.index.solr;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.solr.schema.BoolField;
import org.apache.solr.schema.FieldType;
import org.apache.solr.schema.StrField;
/**
* Constant values used to configure this Solr-based implementation
* of a Sokan index.
*/
public final class SolrConst {
private SolrConst() { }
/**
* The Solr plugin ID:
* <i>org.reuseware.sokan.index.solr</i>.
*/
public static final String PLUGIN_ID = "org.reuseware.sokan.index.solr";
// special field suffixes
/**
* Suffix for multi-value fields.
*/
public static final String SUFFIX_MULTI = "_ms";
/**
* Suffix for single-value fields.
*/
public static final String SUFFIX_SINGLE = "_s";
// index system fields
/**
* Filed that stores the artifact's URI.
*/
public static final String SYS_FIELD_PHY_URI = "phyURI";
/**
* Filed that stores the artifact's ID.
*/
public static final String SYS_FIELD_ID = "artifactID";
/**
* Field to indicate whether an artifact was generated by Sokan.
*/
public static final String SYS_FIELD_GENERATED = "generated";
/**
* List of all predefined fields.
*/
public static final List<String> ALL_SYS_FIELDS = Arrays.asList(
SYS_FIELD_PHY_URI, SYS_FIELD_GENERATED);
/**
* Map from all predefined fields to their types.
*/
public static final Map<String, FieldType> ALL_SYS_TYPES = buildTypeMap();
// Solr configurations
/**
* Name of the index.
*/
public static final String CORE_NAME = "SokanIndex";
/**
* Name of the schema file.
*/
public static final String FILE_SCHEMA = "schema.xml";
/**
* Name of the config file.
*/
public static final String FILE_CONFIG = "solrconfig.xml";
private static Map<String, FieldType> buildTypeMap() {
Map<String, FieldType> map = new HashMap<String, FieldType>();
map.put(SYS_FIELD_PHY_URI, new StrField());
map.put(SYS_FIELD_ID, new StrField());
map.put(SYS_FIELD_GENERATED, new BoolField());
return map;
}
}