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);
}