mirror of https://github.com/apache/lucene.git
LUCENE-5493: fix precommit
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5493@1574962 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4244ad3747
commit
58198c299c
|
@ -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 {
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue