Package org.exist.indexing.sort

Examples of org.exist.indexing.sort.SortIndexWorker


        super(context, signature);
    }

    @Override
    public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
        SortIndexWorker index = (SortIndexWorker)
            context.getBroker().getIndexController().getWorkerByIndexId(SortIndex.ID);
        String id = args[0].getStringValue();
        try {
            if (getArgumentCount() == 2) {
                NodeValue nv = (NodeValue) args[1].itemAt(0);
                if (nv.getImplementationType() == NodeValue.IN_MEMORY_NODE)
                    throw new XPathException(this, "Second argument to remove should be a persistent node, not " +
                        "an in-memory node.");
                NodeProxy proxy = (NodeProxy) nv;
                index.remove(id, proxy.getDocument());
            } else {
                index.remove(id);
            }
        } catch (EXistException e) {
            throw new XPathException(this, e.getMessage(), e);
        } catch (LockException e) {
            throw new XPathException(this, "Caught lock error while removing index. Giving up.", e);
View Full Code Here


            items.add(si);
        }
        // sort the set
        FastQSort.sort(items, 0, items.size() - 1);
        // create the index
        SortIndexWorker index = (SortIndexWorker)
            context.getBroker().getIndexController().getWorkerByIndexId(SortIndex.ID);
        try {
            index.createIndex(id, items);
        } catch (EXistException e) {
            throw new XPathException(this, e.getMessage(), e);
        } catch (LockException e) {
            throw new XPathException(this, "Caught lock error while creating index. Giving up.", e);
        }
View Full Code Here

    public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
        if (args[1].isEmpty())
            return Sequence.EMPTY_SEQUENCE;
        String id = args[0].getStringValue();
        NodeProxy node = (NodeProxy) args[1].itemAt(0);
        SortIndexWorker index = (SortIndexWorker)
            context.getBroker().getIndexController().getWorkerByIndexId(SortIndex.ID);
        long pos = 0;
        try {
            pos = index.getIndex(id, node);
        } catch (EXistException e) {
            throw new XPathException(this, e.getMessage(), e);
        } catch (LockException e) {
            throw new XPathException(this, "Caught lock error while searching index. Giving up.", e);
        }
View Full Code Here

    }

    @Override
    public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
        String id = args[0].getStringValue();
        SortIndexWorker index = (SortIndexWorker)
            context.getBroker().getIndexController().getWorkerByIndexId(SortIndex.ID);
        try {
            return BooleanValue.valueOf(index.hasIndex(id));
        } catch (EXistException e) {
            throw new XPathException(this, e.getMessage(), e);
        } catch (LockException e) {
            throw new XPathException(this, "Caught lock error while searching index. Giving up.", e);
        }
View Full Code Here

TOP

Related Classes of org.exist.indexing.sort.SortIndexWorker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.