diff --git a/inception/inception-kb-lucene-sail/LICENSE.txt b/inception/inception-kb-lucene-sail/LICENSE.txt
deleted file mode 100644
index 84dc5416914..00000000000
--- a/inception/inception-kb-lucene-sail/LICENSE.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.
-Copyright Aduna (http://www.aduna-software.com/) 2001-2013
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-* Neither the name of the Eclipse Foundation, Inc. nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/inception/inception-kb-lucene-sail/NOTICE.txt b/inception/inception-kb-lucene-sail/NOTICE.txt
deleted file mode 100644
index 4358ff77d97..00000000000
--- a/inception/inception-kb-lucene-sail/NOTICE.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-NOTE: See META-INF/DEPENDENCIES-EMBEDDED.spdx.json
-
-= RDF4J Lucene SAIL
-
-Source: https://github.com/eclipse-rdf4j/rdf4j/tree/4.3.13
-License: Eclipse Distribution License v1.0
- https://eclipse.org/org/documents/edl-v10.php
-
-Adapted version that builds against Lucene 9.
diff --git a/inception/inception-kb-lucene-sail/pom.xml b/inception/inception-kb-lucene-sail/pom.xml
deleted file mode 100644
index 13a07bef6e3..00000000000
--- a/inception/inception-kb-lucene-sail/pom.xml
+++ /dev/null
@@ -1,188 +0,0 @@
-
-
-
- 4.0.0
-
- de.tudarmstadt.ukp.inception.app
- inception-app
- 43.0-SNAPSHOT
-
- inception-kb-lucene-sail
- RDF4J: Lucene Sail Index
- StackableSail implementation offering full-text search on
- literals, based on Apache Lucene.
-
-
- org.eclipse.rdf4j
- rdf4j-sail-api
-
-
- org.eclipse.rdf4j
- rdf4j-sail-lucene-api
-
-
- org.eclipse.rdf4j
- rdf4j-query
-
-
- org.eclipse.rdf4j
- rdf4j-model-api
-
-
- org.eclipse.rdf4j
- rdf4j-model-vocabulary
-
-
- org.eclipse.rdf4j
- rdf4j-common-exception
-
-
- org.eclipse.rdf4j
- rdf4j-queryalgebra-model
-
-
- org.eclipse.rdf4j
- rdf4j-common-iterator
-
-
- org.apache.lucene
- lucene-core
-
-
- org.apache.lucene
- lucene-highlighter
-
-
- org.apache.lucene
- lucene-queryparser
-
-
- org.apache.lucene
- lucene-spatial-extras
-
-
- org.apache.lucene
- lucene-sandbox
-
-
- org.locationtech.spatial4j
- spatial4j
-
-
- com.google.guava
- guava
-
-
- org.slf4j
- slf4j-api
-
-
- org.apache.commons
- commons-lang3
-
-
-
- org.eclipse.rdf4j
- rdf4j-queryalgebra-geosparql
- test
-
-
- org.eclipse.rdf4j
- rdf4j-rio-rdfxml
- test
-
-
- org.eclipse.rdf4j
- rdf4j-rio-api
- test
-
-
- org.eclipse.rdf4j
- rdf4j-model
- test
-
-
- org.eclipse.rdf4j
- rdf4j-repository-api
- test
-
-
- org.eclipse.rdf4j
- rdf4j-sail-base
- test
-
-
- org.eclipse.rdf4j
- rdf4j-repository-sail
- test
-
-
- org.eclipse.rdf4j
- rdf4j-sail-memory
- test
-
-
- org.apache.lucene
- lucene-analysis-common
- test
-
-
-
-
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- default
-
-
-
- src/main/java/**
- src/test/java/**
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
-
-
-
- org.eclipse.rdf4j:rdf4j-common-exception
- org.eclipse.rdf4j:rdf4j-queryalgebra-geosparql
- org.eclipse.rdf4j:rdf4j-rio-rdfxml
-
-
-
-
-
-
-
diff --git a/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocument.java b/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocument.java
deleted file mode 100644
index 69a2dcda22c..00000000000
--- a/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocument.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.impl;
-
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.LatLonPoint;
-import org.apache.lucene.document.LatLonShape;
-import org.apache.lucene.geo.Line;
-import org.apache.lucene.geo.Polygon;
-import org.apache.lucene.geo.Rectangle;
-import org.apache.lucene.geo.SimpleWKTShapeParser;
-import org.apache.lucene.index.IndexableField;
-import org.apache.lucene.sandbox.document.LatLonBoundingBox;
-import org.apache.lucene.spatial.SpatialStrategy;
-import org.eclipse.rdf4j.sail.lucene.LuceneSail;
-import org.eclipse.rdf4j.sail.lucene.SearchDocument;
-import org.eclipse.rdf4j.sail.lucene.SearchFields;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Function;
-
-public class LuceneDocument
- implements SearchDocument
-{
-
- private final Document doc;
- private final Logger logger = LoggerFactory.getLogger(getClass());
-
- private static final String POINT_FIELD_PREFIX = "_pt_";
- private static final String GEO_FIELD_PREFIX = "_geo_";
-
- private final Function super String, ? extends SpatialStrategy> geoStrategyMapper;
-
- public LuceneDocument(Function super String, ? extends SpatialStrategy> geoStrategyMapper)
- {
- this(new Document(), geoStrategyMapper);
- }
-
- public LuceneDocument(Document doc,
- Function super String, ? extends SpatialStrategy> geoStrategyMapper)
- {
- this.doc = doc;
- this.geoStrategyMapper = geoStrategyMapper;
- }
-
- public LuceneDocument(String id, String resourceId, String context,
- Function super String, ? extends SpatialStrategy> geoStrategyMapper)
- {
- this(geoStrategyMapper);
- setId(id);
- setResource(resourceId);
- setContext(context);
- }
-
- private void setId(String id)
- {
- LuceneIndex.addIDField(id, doc);
- }
-
- private void setContext(String context)
- {
- LuceneIndex.addContextField(context, doc);
- }
-
- private void setResource(String resourceId)
- {
- LuceneIndex.addResourceField(resourceId, doc);
- }
-
- public Document getDocument()
- {
- return doc;
- }
-
- @Override
- public String getId()
- {
- return doc.get(SearchFields.ID_FIELD_NAME);
- }
-
- @Override
- public String getResource()
- {
- return doc.get(SearchFields.URI_FIELD_NAME);
- }
-
- @Override
- public String getContext()
- {
- return doc.get(SearchFields.CONTEXT_FIELD_NAME);
- }
-
- @Override
- public Set getPropertyNames()
- {
- List fields = doc.getFields();
- Set names = new HashSet<>();
- for (IndexableField field : fields) {
- String name = field.name();
- if (SearchFields.isPropertyField(name)) {
- names.add(name);
- }
- }
- return names;
- }
-
- @Override
- public void addProperty(String name)
- {
- // don't need to do anything
- }
-
- /**
- * Stores and indexes a property in a Document. We don't have to recalculate the concatenated
- * text: just add another TEXT field and Lucene will take care of this. Additional advantage:
- * Lucene may be able to handle the invididual strings in a way that may affect e.g. phrase and
- * proximity searches (concatenation basically means loss of information). NOTE: The
- * TEXT_FIELD_NAME has to be stored, see in LuceneSail
- *
- * @see LuceneSail
- */
- @Override
- public void addProperty(String name, String text)
- {
- LuceneIndex.addPredicateField(name, text, doc);
- LuceneIndex.addTextField(text, doc);
- }
-
- /**
- * Checks whether a field occurs with a specified value in a Document.
- */
- @Override
- public boolean hasProperty(String fieldName, String value)
- {
- String[] fields = doc.getValues(fieldName);
- if (fields != null) {
- for (String field : fields) {
- if (value.equals(field)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- @Override
- public List getProperty(String name)
- {
- return Arrays.asList(doc.getValues(name));
- }
-
- private void indexShape(Object shape, String field)
- {
-
- if (shape instanceof Object[]) { // case of GEOMETRYCOLLECTION
- Object[] geometries = (Object[]) shape;
-
- for (int i = 0; i < geometries.length; i++) {
- indexShape(geometries[i], field);
- }
- }
- else {
- if (shape instanceof Polygon) { // WKT:POLYGON
- for (Field f : LatLonShape.createIndexableFields(GEO_FIELD_PREFIX + field,
- (Polygon) shape)) {
- doc.add(f);
- }
- }
- else if (shape instanceof Line) { // WKT:LINESTRING
- for (Field f : LatLonShape.createIndexableFields(GEO_FIELD_PREFIX + field,
- (Line) shape)) {
- doc.add(f);
- }
- }
- else if (shape instanceof double[]) { // WKT:POINT
- double[] point = (double[]) shape;
-
- for (Field f : LatLonShape.createIndexableFields(GEO_FIELD_PREFIX + field, point[1],
- point[0])) {
- doc.add(f);
- }
- doc.add(new LatLonPoint(POINT_FIELD_PREFIX + field, point[1], point[0]));
- }
- else if (shape instanceof Rectangle) { // WKT:ENVELOPE / RECTANGLE
- Rectangle box = (Rectangle) shape;
- doc.add(new LatLonBoundingBox(GEO_FIELD_PREFIX + field, box.minLat, box.minLon,
- box.maxLat, box.maxLon));
- }
- else {
- throw new IllegalArgumentException(
- "Geometry for shape " + shape.toString() + " is not supported");
- }
- }
- }
-
- @Override
- public void addGeoProperty(String field, String value)
- {
- LuceneIndex.addStoredOnlyPredicateField(field, value, doc);
- try {
- String wkt = value;
- Object shape = SimpleWKTShapeParser.parse(wkt);
- indexShape(shape, field);
- }
- catch (ParseException e) {
- logger.warn("error while processing geo property", e);
- }
- catch (IOException e) {
- logger.warn("error while parsing wkt geometry", e);
- }
- }
-}
diff --git a/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocumentDistance.java b/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocumentDistance.java
deleted file mode 100644
index 2fba7bc76a7..00000000000
--- a/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocumentDistance.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.impl;
-
-import java.text.ParseException;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.lucene.search.ScoreDoc;
-import org.eclipse.rdf4j.model.IRI;
-import org.eclipse.rdf4j.sail.lucene.DocumentDistance;
-import org.eclipse.rdf4j.sail.lucene.SearchFields;
-import org.eclipse.rdf4j.sail.lucene.util.GeoUnits;
-import org.locationtech.spatial4j.shape.Point;
-import org.locationtech.spatial4j.shape.Shape;
-
-import com.google.common.collect.Sets;
-
-public class LuceneDocumentDistance
- extends LuceneDocumentResult
- implements DocumentDistance
-{
-
- private final String geoProperty;
-
- private final IRI units;
-
- private final Point origin;
-
- private static Set requiredFields(String geoProperty, boolean includeContext)
- {
- Set fields = Sets.newHashSet(SearchFields.URI_FIELD_NAME, geoProperty);
- if (includeContext) {
- fields.add(SearchFields.CONTEXT_FIELD_NAME);
- }
- return fields;
- }
-
- public LuceneDocumentDistance(ScoreDoc doc, String geoProperty, IRI units, Point origin,
- boolean includeContext, LuceneIndex index)
- {
- super(doc, index, requiredFields(geoProperty, includeContext));
- this.geoProperty = geoProperty;
- this.units = units;
- this.origin = origin;
- }
-
- @Override
- public double getDistance()
- {
- List wkts = getDocument().getProperty(geoProperty);
- double min = Double.POSITIVE_INFINITY;
- for (String wkt : wkts) {
- Shape shape;
- try {
- shape = index.getSpatialContext(geoProperty).readShapeFromWkt(wkt);
- double dist = index.getSpatialContext(geoProperty).calcDistance(shape.getCenter(),
- origin);
- min = Math.min(dist, min);
- }
- catch (ParseException e) {
- // ignore
- }
- }
- return GeoUnits.fromDegrees(min, units);
- }
-}
diff --git a/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocumentResult.java b/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocumentResult.java
deleted file mode 100644
index ffda6db9c4a..00000000000
--- a/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocumentResult.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.impl;
-
-import java.util.Set;
-
-import org.apache.lucene.document.Document;
-import org.apache.lucene.search.ScoreDoc;
-import org.eclipse.rdf4j.sail.lucene.DocumentResult;
-import org.eclipse.rdf4j.sail.lucene.SearchDocument;
-
-public class LuceneDocumentResult
- implements DocumentResult
-{
-
- protected final ScoreDoc scoreDoc;
-
- protected final LuceneIndex index;
-
- private final Set fields;
-
- private LuceneDocument fullDoc;
-
- public LuceneDocumentResult(ScoreDoc doc, LuceneIndex index, Set fields)
- {
- this.scoreDoc = doc;
- this.index = index;
- this.fields = fields;
- }
-
- @Override
- public SearchDocument getDocument()
- {
- if (fullDoc == null) {
- Document doc = index.getDocument(scoreDoc.doc, fields);
- fullDoc = new LuceneDocument(doc, index.getSpatialStrategyMapper());
- }
- return fullDoc;
- }
-}
diff --git a/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocumentScore.java b/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocumentScore.java
deleted file mode 100644
index 076de036f43..00000000000
--- a/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneDocumentScore.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.impl;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.lucene.search.ScoreDoc;
-import org.apache.lucene.search.highlight.Highlighter;
-import org.eclipse.rdf4j.sail.lucene.DocumentScore;
-import org.eclipse.rdf4j.sail.lucene.SearchFields;
-
-import com.google.common.collect.Iterables;
-
-public class LuceneDocumentScore
- extends LuceneDocumentResult
- implements DocumentScore
-{
-
- private final Highlighter highlighter;
-
- private static Set requiredFields(boolean all)
- {
- return all ? null : Collections.singleton(SearchFields.URI_FIELD_NAME);
- }
-
- public LuceneDocumentScore(ScoreDoc doc, Highlighter highlighter, LuceneIndex index)
- {
- super(doc, index, requiredFields(highlighter != null));
- this.highlighter = highlighter;
- }
-
- @Override
- public float getScore()
- {
- return scoreDoc.score;
- }
-
- @Override
- public boolean isHighlighted()
- {
- return (highlighter != null);
- }
-
- @Override
- public Iterable getSnippets(final String field)
- {
- List values = getDocument().getProperty(field);
- if (values == null) {
- return null;
- }
- return Iterables.transform(values,
- (String text) -> index.getSnippet(field, text, highlighter));
- }
-}
diff --git a/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneIndex.java b/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneIndex.java
deleted file mode 100644
index d67c24e3c9c..00000000000
--- a/inception/inception-kb-lucene-sail/src/main/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneIndex.java
+++ /dev/null
@@ -1,1327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.impl;
-
-import static org.eclipse.rdf4j.sail.lucene.LuceneSail.FUZZY_PREFIX_LENGTH_KEY;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.Supplier;
-
-import org.apache.commons.lang3.math.NumberUtils;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.document.LatLonPoint;
-import org.apache.lucene.document.LatLonShape;
-import org.apache.lucene.document.ShapeField;
-import org.apache.lucene.document.StoredField;
-import org.apache.lucene.document.StringField;
-import org.apache.lucene.document.TextField;
-import org.apache.lucene.geo.Line;
-import org.apache.lucene.geo.Polygon;
-import org.apache.lucene.geo.Rectangle;
-import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.FieldInfo;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.IndexWriterConfig.OpenMode;
-import org.apache.lucene.index.IndexableField;
-import org.apache.lucene.index.LeafReader;
-import org.apache.lucene.index.LeafReaderContext;
-import org.apache.lucene.index.PostingsEnum;
-import org.apache.lucene.index.StoredFieldVisitor;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryparser.classic.ParseException;
-import org.apache.lucene.queryparser.classic.QueryParser;
-import org.apache.lucene.search.BooleanClause.Occur;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.BoostQuery;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.ScoreDoc;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.TopDocs;
-import org.apache.lucene.search.highlight.Formatter;
-import org.apache.lucene.search.highlight.Highlighter;
-import org.apache.lucene.search.highlight.QueryScorer;
-import org.apache.lucene.search.highlight.SimpleHTMLFormatter;
-import org.apache.lucene.search.similarities.ClassicSimilarity;
-import org.apache.lucene.search.similarities.Similarity;
-import org.apache.lucene.spatial.SpatialStrategy;
-import org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy;
-import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
-import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTreeFactory;
-import org.apache.lucene.spatial.query.SpatialOperation;
-import org.apache.lucene.store.ByteBuffersDirectory;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.FSDirectory;
-import org.apache.lucene.util.Bits;
-import org.eclipse.rdf4j.common.iterator.EmptyIterator;
-import org.eclipse.rdf4j.model.IRI;
-import org.eclipse.rdf4j.model.Resource;
-import org.eclipse.rdf4j.model.vocabulary.GEOF;
-import org.eclipse.rdf4j.query.MalformedQueryException;
-import org.eclipse.rdf4j.query.algebra.Var;
-import org.eclipse.rdf4j.sail.SailException;
-import org.eclipse.rdf4j.sail.lucene.AbstractLuceneIndex;
-import org.eclipse.rdf4j.sail.lucene.AbstractReaderMonitor;
-import org.eclipse.rdf4j.sail.lucene.BulkUpdater;
-import org.eclipse.rdf4j.sail.lucene.DocumentDistance;
-import org.eclipse.rdf4j.sail.lucene.DocumentResult;
-import org.eclipse.rdf4j.sail.lucene.DocumentScore;
-import org.eclipse.rdf4j.sail.lucene.LuceneSail;
-import org.eclipse.rdf4j.sail.lucene.QuerySpec;
-import org.eclipse.rdf4j.sail.lucene.SearchDocument;
-import org.eclipse.rdf4j.sail.lucene.SearchFields;
-import org.eclipse.rdf4j.sail.lucene.SimpleBulkUpdater;
-import org.eclipse.rdf4j.sail.lucene.util.GeoUnits;
-import org.locationtech.spatial4j.context.SpatialContext;
-import org.locationtech.spatial4j.context.SpatialContextFactory;
-import org.locationtech.spatial4j.shape.Point;
-import org.locationtech.spatial4j.shape.Shape;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
-/**
- * A LuceneIndex is a one-stop-shop abstraction of a Lucene index. It takes care of proper
- * synchronization of IndexReaders, IndexWriters and IndexSearchers in a way that is suitable for a
- * LuceneSail.
- *
- * @see LuceneSail
- */
-public class LuceneIndex
- extends AbstractLuceneIndex
-{
-
- static {
- // do NOT set this to Integer.MAX_VALUE, because this breaks fuzzy
- // queries
- IndexSearcher.setMaxClauseCount(1024 * 1024);
- }
-
- private static final String GEO_FIELD_PREFIX = "_geo_";
- private static final String POINT_FIELD_PREFIX = "_pt_";
-
- private final Logger logger = LoggerFactory.getLogger(getClass());
-
- /**
- * The Directory that holds the Lucene index files.
- */
- private volatile Directory directory;
-
- /**
- * The Analyzer used to tokenize strings and queries.
- */
- private volatile Analyzer analyzer;
-
- private volatile Analyzer queryAnalyzer;
-
- private volatile Similarity similarity;
-
- private volatile int fuzzyPrefixLength;
-
- /**
- * The IndexWriter that can be used to alter the index' contents. Created lazily.
- */
- private volatile IndexWriter indexWriter;
-
- /**
- * This holds IndexReader and IndexSearcher.
- */
- protected volatile ReaderMonitor currentMonitor;
-
- private volatile Function super String, ? extends SpatialStrategy> geoStrategyMapper;
-
- private final AtomicBoolean closed = new AtomicBoolean(false);
-
- public LuceneIndex()
- {
- }
-
- /**
- * Constructor for keeping backwards compatibility.
- *
- * @param directory
- * @param analyzer
- * @throws IOException
- */
- public LuceneIndex(Directory directory, Analyzer analyzer) throws IOException
- {
- this(directory, analyzer, new ClassicSimilarity());
- }
-
- /**
- * Creates a new LuceneIndex.
- *
- * @param directory
- * The Directory in which an index can be found and/or in which index files are
- * written.
- * @param analyzer
- * The Analyzer that will be used for tokenizing strings to index and queries.
- * @param similarity
- * The Similarity that will be used for scoring.
- * @throws IOException
- * When the Directory could not be unlocked.
- */
- public LuceneIndex(Directory directory, Analyzer analyzer, Similarity similarity)
- throws IOException
- {
- this.directory = directory;
- this.analyzer = analyzer;
- this.queryAnalyzer = analyzer;
- this.similarity = similarity;
- this.geoStrategyMapper = createSpatialStrategyMapper(
- Collections. emptyMap());
-
- postInit();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public synchronized void initialize(Properties parameters) throws Exception
- {
- super.initialize(parameters);
- this.directory = createDirectory(parameters);
- this.analyzer = createAnalyzer(parameters);
- this.queryAnalyzer = createQueryAnalyzer(parameters);
- this.similarity = createSimilarity(parameters);
- // slightly hacky cast to cope with the fact that Properties is
- // Map