private void sort(final CompiledSorter<Item> sorter) {
            int maxFieldIndex = -1;
            final List<CompiledSort> compiledSorts = sorter.getCompiledSorts();
            for (final CompiledSort compiledSort : compiledSorts) {
                final int fieldIndex = compiledSort.getFieldIndex();
                maxFieldIndex = Math.max(maxFieldIndex, fieldIndex);
            }

            final SortableItem[] sortableItems = new SortableItem[size];
            // Resolve all values before sorting.
            for (int i = 0; i < size; i++) {
                final ItemImpl item = array[i];
                final Val[] values = new Val[maxFieldIndex + 1];
                for (final CompiledSort compiledSort : compiledSorts) {
                    final int fieldIndex = compiledSort.getFieldIndex();
                    values[fieldIndex] = item.getValue(fieldIndex);
                }
                sortableItems[i] = new SortableItem(item, values);
            }
            // Sort.
            Arrays.sort(sortableItems, sorter);
            // Put sorted items back in the array.
            for (int i = 0; i < size; i++) {
                array[i] = sortableItems[i].item;
            }
        }
Set to false if we don't want to keep looking through the store.
stroom-query/stroom-query-common/src/main/java/stroom/query/common/v2/LmdbDataStore.java