Skip to content

Commit 2b08060

Browse files
committed
find siblings is known to be sorted
IS IT ? Need more confirmation from @adamretter, but it appears to work for this workload. Take forward and we can discuss later..
1 parent 6981535 commit 2b08060

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

exist-core/src/main/java/org/exist/dom/persistent/NewArrayNodeSet.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,13 @@ private boolean checkSorted() {
498498
return true;
499499
}
500500

501+
@Override
502+
public void setKnownSorted(final boolean mergeContexts) {
503+
isSorted = true;
504+
removeDuplicates(mergeContexts);
505+
updateDocs();
506+
}
507+
501508
@Override
502509
public void sort(final boolean mergeContexts) {
503510
if(isSorted) {

exist-core/src/main/java/org/exist/dom/persistent/NodeSet.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,4 +386,6 @@ boolean matchAncestorDescendant(NodeSet al, int mode, boolean includeSelf,
386386

387387
void setTrackMatches(boolean track);
388388

389+
default void setKnownSorted(final boolean mergeContexts) {
390+
}
389391
}

exist-core/src/main/java/org/exist/xquery/LocationStep.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@ protected Sequence getSiblings(final XQueryContext context, final Sequence conte
883883
+ "'");
884884
}
885885
currentSet = index.findElementsByTagName(ElementValue.ELEMENT, docs, test.getName(), null, this);
886+
currentSet.setKnownSorted(true);
886887
currentDocs = docs;
887888
registerUpdateListener();
888889
}

0 commit comments

Comments
 (0)