Class AbstractSearchIndex

    • Field Detail

      • defaultNumDocs

        protected int defaultNumDocs
      • maxDocs

        protected int maxDocs
    • Constructor Detail

      • AbstractSearchIndex

        public AbstractSearchIndex()
    • Method Detail

      • getSpatialContext

        protected abstract org.locationtech.spatial4j.context.SpatialContext getSpatialContext​(String property)
      • accept

        public boolean accept​(org.eclipse.rdf4j.model.Literal literal)
        Returns whether the provided literal is accepted by the LuceneIndex to be indexed. It for instance does not make much since to index xsd:float.
        Specified by:
        accept in interface SearchIndex
        Parameters:
        literal - the literal to be accepted
        Returns:
        true if the given literal will be indexed by this LuceneIndex
      • isGeoField

        public boolean isGeoField​(String fieldName)
        Description copied from interface: SearchIndex
        Returns true if the given property contains a geometry.
        Specified by:
        isGeoField in interface SearchIndex
        Returns:
        boolean
      • getIndexedTypeMapping

        public Map<org.eclipse.rdf4j.model.IRI,​Set<org.eclipse.rdf4j.model.IRI>> getIndexedTypeMapping()
        Specified by:
        getIndexedTypeMapping in interface SearchIndex
        Returns:
        the accepted types for a particular predicate map (predicate -> [objects])
      • removeStatement

        public final void removeStatement​(org.eclipse.rdf4j.model.Statement statement)
                                   throws IOException
        Description copied from interface: SearchIndex
        Removes the specified Statement from the indexes.This should be called from within a begin-commit-rollback

        block.

        Specified by:
        removeStatement in interface SearchIndex
        Throws:
        IOException
      • addRemoveStatements

        public final void addRemoveStatements​(Collection<org.eclipse.rdf4j.model.Statement> added,
                                              Collection<org.eclipse.rdf4j.model.Statement> removed)
                                       throws IOException
        Add many statements at the same time, remove many statements at the same time. Ordering by resource has to be done inside this method. The passed added/removed sets are disjunct, no statement can be in both
        Specified by:
        addRemoveStatements in interface SearchIndex
        Parameters:
        added - all added statements, can have multiple subjects
        removed - all removed statements, can have multiple subjects
        Throws:
        IOException
      • addDocuments

        public final void addDocuments​(org.eclipse.rdf4j.model.Resource subject,
                                       List<org.eclipse.rdf4j.model.Statement> statements)
                                throws IOException
        Add a complete Lucene Document based on these statements. Do not search for an existing document with the same subject id. (assume the existing document was deleted)
        Specified by:
        addDocuments in interface SearchIndex
        Parameters:
        statements - the statements that make up the resource
        Throws:
        IOException
      • getResource

        protected org.eclipse.rdf4j.model.Resource getResource​(SearchDocument document)
        Returns the Resource corresponding with the specified Document.
      • query

        protected abstract Iterable<? extends DocumentScore> query​(org.eclipse.rdf4j.model.Resource subject,
                                                                   QuerySpec param)
                                                            throws org.eclipse.rdf4j.query.MalformedQueryException,
                                                                   IOException
        Throws:
        org.eclipse.rdf4j.query.MalformedQueryException
        IOException
      • geoQuery

        protected abstract Iterable<? extends DocumentDistance> geoQuery​(org.eclipse.rdf4j.model.IRI geoProperty,
                                                                         org.locationtech.spatial4j.shape.Point p,
                                                                         org.eclipse.rdf4j.model.IRI units,
                                                                         double distance,
                                                                         String distanceVar,
                                                                         org.eclipse.rdf4j.query.algebra.Var context)
                                                                  throws org.eclipse.rdf4j.query.MalformedQueryException,
                                                                         IOException
        Throws:
        org.eclipse.rdf4j.query.MalformedQueryException
        IOException
      • geoRelationQuery

        protected abstract Iterable<? extends DocumentResult> geoRelationQuery​(String relation,
                                                                               org.eclipse.rdf4j.model.IRI geoProperty,
                                                                               String wkt,
                                                                               org.eclipse.rdf4j.query.algebra.Var context)
                                                                        throws org.eclipse.rdf4j.query.MalformedQueryException,
                                                                               IOException
        Throws:
        org.eclipse.rdf4j.query.MalformedQueryException
        IOException
      • newBulkUpdate

        protected abstract BulkUpdater newBulkUpdate()