org.eclipse.rdf4j.sail.lucene.util.SearchIndexUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rdf4j-sail-lucene-api Show documentation
Show all versions of rdf4j-sail-lucene-api Show documentation
StackableSail API offering full-text search on literals, based on Apache Lucene.
The newest version!
/*******************************************************************************
* Copyright (c) 2017 Eclipse RDF4J contributors, Aduna, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/
package org.eclipse.rdf4j.sail.lucene.util;
import static org.eclipse.rdf4j.sail.lucene.LuceneSail.DEFAULT_INDEX_CLASS;
import static org.eclipse.rdf4j.sail.lucene.LuceneSail.INDEX_CLASS_KEY;
import java.util.Properties;
import org.eclipse.rdf4j.sail.lucene.LuceneSail;
import org.eclipse.rdf4j.sail.lucene.SearchIndex;
/**
* This is utility class with tool useful for manipulation on the {@link SearchIndex}.
*
* @author jacek grzebyta
* @version 2.3
*/
public class SearchIndexUtils {
/**
* The method creates instance of {@link SearchIndex}. The type of instantiated class depends on the value of
* {@link LuceneSail#INDEX_CLASS_KEY} parameter. By default it is
* org.eclipse.rdf4j.sail.lucene.LuceneIndex
.
*
* @param parameters
* @return search index
* @throws Exception
*/
public static SearchIndex createSearchIndex(Properties parameters) throws Exception {
String indexClassName = parameters.getProperty(INDEX_CLASS_KEY, DEFAULT_INDEX_CLASS);
SearchIndex index = (SearchIndex) Class.forName(indexClassName).newInstance();
index.initialize(parameters);
return index;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy