Search in sources :

Example 6 with IndexSpec

use of org.exist.storage.IndexSpec in project exist by eXist-db.

the class AbstractGMLJDBCIndexWorker method setDocument.

@Override
public void setDocument(DocumentImpl document) {
    isDocumentGMLAware = false;
    documentDeleted = false;
    if (document != null) {
        IndexSpec idxConf = document.getCollection().getIndexConfiguration(getBroker());
        if (idxConf != null) {
            final Map collectionConfig = (Map) idxConf.getCustomIndexSpec(AbstractGMLJDBCIndex.ID);
            if (collectionConfig != null) {
                isDocumentGMLAware = true;
                if (collectionConfig.get(AbstractGMLJDBCIndex.ID) != null)
                    flushAfter = ((GMLIndexConfig) collectionConfig.get(AbstractGMLJDBCIndex.ID)).getFlushAfter();
            }
        }
    }
    if (isDocumentGMLAware) {
        currentDoc = document;
    } else {
        currentDoc = null;
        currentMode = ReindexMode.UNKNOWN;
    }
}
Also used : IndexSpec(org.exist.storage.IndexSpec) NamedNodeMap(org.w3c.dom.NamedNodeMap)

Example 7 with IndexSpec

use of org.exist.storage.IndexSpec in project exist by eXist-db.

the class Lookup method findConfiguration.

private RangeIndexConfigElement findConfiguration(Sequence contextSequence) {
    NodePath path = contextPath;
    if (path == null) {
        if (contextQName == null) {
            return null;
        }
        path = new NodePath(contextQName);
    }
    for (final Iterator<Collection> i = contextSequence.getCollectionIterator(); i.hasNext(); ) {
        final Collection collection = i.next();
        if (collection.getURI().startsWith(XmldbURI.SYSTEM_COLLECTION_URI)) {
            continue;
        }
        IndexSpec idxConf = collection.getIndexConfiguration(context.getBroker());
        if (idxConf != null) {
            RangeIndexConfig config = (RangeIndexConfig) idxConf.getCustomIndexSpec(RangeIndex.ID);
            if (config != null) {
                RangeIndexConfigElement rice = config.find(path);
                if (rice != null && !rice.isComplex()) {
                    return rice;
                }
            }
        }
    }
    return null;
}
Also used : IndexSpec(org.exist.storage.IndexSpec) RangeIndexConfigElement(org.exist.indexing.range.RangeIndexConfigElement) Collection(org.exist.collections.Collection) RangeIndexConfig(org.exist.indexing.range.RangeIndexConfig) NodePath(org.exist.storage.NodePath)

Example 8 with IndexSpec

use of org.exist.storage.IndexSpec in project exist by eXist-db.

the class NGramIndexWorker method setDocument.

@Override
public void setDocument(final DocumentImpl document, final ReindexMode newMode) {
    currentDoc = document;
    // config = null;
    while (!contentStack.isEmpty()) {
        contentStack.pop().reset();
    }
    final IndexSpec indexConf = document.getCollection().getIndexConfiguration(broker);
    if (indexConf != null) {
        config = (Map<QName, ?>) indexConf.getCustomIndexSpec(org.exist.indexing.ngram.NGramIndex.ID);
    }
    mode = newMode;
}
Also used : IndexSpec(org.exist.storage.IndexSpec) QName(org.exist.dom.QName)

Example 9 with IndexSpec

use of org.exist.storage.IndexSpec in project exist by eXist-db.

the class RangeIndexWorker method isCaseSensitive.

/**
 * Return the analyzer to be used for the given field or qname. Either field
 * or qname should be specified.
 */
private boolean isCaseSensitive(QName qname, String fieldName, DocumentSet docs) {
    for (Iterator<Collection> i = docs.getCollectionIterator(); i.hasNext(); ) {
        Collection collection = i.next();
        IndexSpec idxConf = collection.getIndexConfiguration(broker);
        if (idxConf != null) {
            RangeIndexConfig config = (RangeIndexConfig) idxConf.getCustomIndexSpec(RangeIndex.ID);
            if (config != null && !config.isCaseSensitive(qname, fieldName)) {
                return false;
            }
        }
    }
    return true;
}
Also used : IndexSpec(org.exist.storage.IndexSpec) Collection(org.exist.collections.Collection)

Example 10 with IndexSpec

use of org.exist.storage.IndexSpec in project exist by eXist-db.

the class RangeIndexWorker method setDocument.

@Override
public void setDocument(DocumentImpl document, ReindexMode mode) {
    this.currentDoc = document;
    IndexSpec indexConf = document.getCollection().getIndexConfiguration(broker);
    if (indexConf != null) {
        config = (RangeIndexConfig) indexConf.getCustomIndexSpec(RangeIndex.ID);
        if (config != null)
            // Create a copy of the original RangeIndexConfig (there's only one per db instance),
            // so we can safely work with it.
            config = new RangeIndexConfig(config);
    } else {
        config = RangeIndexConfig.DEFAULT_CONFIG;
    }
    this.mode = mode;
}
Also used : IndexSpec(org.exist.storage.IndexSpec)

Aggregations

IndexSpec (org.exist.storage.IndexSpec)16 Collection (org.exist.collections.Collection)7 QName (org.exist.dom.QName)4 RangeIndexConfig (org.exist.indexing.range.RangeIndexConfig)2 Element (org.w3c.dom.Element)2 NamedNodeMap (org.w3c.dom.NamedNodeMap)2 NodeList (org.w3c.dom.NodeList)2 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 Analyzer (org.apache.lucene.analysis.Analyzer)1 IStoredNode (org.exist.dom.persistent.IStoredNode)1 Match (org.exist.dom.persistent.Match)1 NewArrayNodeSet (org.exist.dom.persistent.NewArrayNodeSet)1 NodeProxy (org.exist.dom.persistent.NodeProxy)1 NodeSet (org.exist.dom.persistent.NodeSet)1 RangeIndexConfigElement (org.exist.indexing.range.RangeIndexConfigElement)1 NodePath (org.exist.storage.NodePath)1 DatabaseConfigurationException (org.exist.util.DatabaseConfigurationException)1 Node (org.w3c.dom.Node)1