Skip to content

Apache Lucene open-source search software

LUCENE-5493: fix precommit

Robert Muir58198c299cd8
diff --git a/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java b/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java
index c2a2a476b28..3029bcab656 100644
--- a/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java
+++ b/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java
@@ -31,7 +31,16 @@ import org.apache.lucene.util.FixedBitSet;
/**
* Helper class to sort readers that contain blocks of documents.
+ * <p>
+ * Note that this currently has some limitations:
+ * <ul>
+ * <li>Cannot yet be used with IndexSearcher.searchAfter
+ * <li>Filling sort value fields is not yet supported.
+ * </ul>
+ * Its intended to be used with {@link SortingMergePolicy}.
*/
+// TODO: can/should we clean this thing up (e.g. return a proper sort value)
+// and move to the join/ module?
public class BlockJoinComparatorSource extends FieldComparatorSource {
final Filter parentsFilter;
final Sort parentSort;
@@ -84,8 +93,8 @@ public class BlockJoinComparatorSource extends FieldComparatorSource {
childComparators[i] = childFields[i].getComparator(1, i);
}
- // NOTE: not quite right i guess, really our sort "value" is more complex...
- // but at the moment you really should only use this at indexing time.
+ // NOTE: we could return parent ID as value but really our sort "value" is more complex...
+ // So we throw UOE for now. At the moment you really should only use this at indexing time.
return new FieldComparator<Integer>() {
int bottomParent;
int bottomChild;
@@ -171,7 +180,6 @@ public class BlockJoinComparatorSource extends FieldComparatorSource {
int compare(int docID1, int parent1, int docID2, int parent2) throws IOException {
if (parent1 == parent2) { // both are in the same block
- // nocommit: should not be needed?
if (docID1 == parent1 || docID2 == parent2) {
// keep parents at the end of blocks
return docID1 - docID2;
@@ -180,7 +188,6 @@ public class BlockJoinComparatorSource extends FieldComparatorSource {
}
} else {
int cmp = compare(parent1, parent2, parentComparators, parentReverseMul);
- // nocommit: should not be needed?
if (cmp == 0) {
return parent1 - parent2;
} else {
diff --git a/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingAtomicReader.java b/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingAtomicReader.java
index 55693434459..1ecde39d9e2 100644
--- a/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingAtomicReader.java
+++ b/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingAtomicReader.java
@@ -49,13 +49,13 @@ import org.apache.lucene.util.automaton.CompiledAutomaton;
/**
* An {@link AtomicReader} which supports sorting documents by a given
- * {@link Sorter}. You can use this class to sort an index as follows:
+ * {@link Sort}. You can use this class to sort an index as follows:
*
* <pre class="prettyprint">
* IndexWriter writer; // writer to which the sorted index will be added
* DirectoryReader reader; // reader on the input index
- * Sorter sorter; // determines how the documents are sorted
- * AtomicReader sortingReader = SortingAtomicReader.wrap(SlowCompositeReaderWrapper.wrap(reader), sorter);
+ * Sort sort; // determines how the documents are sorted
+ * AtomicReader sortingReader = SortingAtomicReader.wrap(SlowCompositeReaderWrapper.wrap(reader), sort);
* writer.addIndexes(reader);
* writer.close();
* reader.close();
@@ -481,7 +481,7 @@ public class SortingAtomicReader extends FilterAtomicReader {
static class SortingDocsAndPositionsEnum extends FilterDocsAndPositionsEnum {
/**
- * A {@link Sorter} which sorts two parallel arrays of doc IDs and
+ * A {@link TimSorter} which sorts two parallel arrays of doc IDs and
* offsets in one go. Everytime a doc ID is 'swapped', its correponding offset
* is swapped too.
*/
@@ -709,7 +709,7 @@ public class SortingAtomicReader extends FilterAtomicReader {
}
/** Return a sorted view of <code>reader</code> according to the order
- * defined by <code>sorter</code>. If the reader is already sorted, this
+ * defined by <code>sort</code>. If the reader is already sorted, this
* method might return the reader as-is. */
public static AtomicReader wrap(AtomicReader reader, Sort sort) throws IOException {
return wrap(reader, new Sorter(sort).sort(reader));