You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2014/03/06 18:03:57 UTC

svn commit: r1574962 - in /lucene/dev/branches/lucene5493/lucene/misc/src/java/org/apache/lucene/index/sorter: BlockJoinComparatorSource.java SortingAtomicReader.java

Author: rmuir
Date: Thu Mar  6 17:03:56 2014
New Revision: 1574962

URL: http://svn.apache.org/r1574962
Log:
LUCENE-5493: fix precommit

Modified:
    lucene/dev/branches/lucene5493/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java
    lucene/dev/branches/lucene5493/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingAtomicReader.java

Modified: lucene/dev/branches/lucene5493/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5493/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java?rev=1574962&r1=1574961&r2=1574962&view=diff
==============================================================================
--- lucene/dev/branches/lucene5493/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java (original)
+++ lucene/dev/branches/lucene5493/lucene/misc/src/java/org/apache/lucene/index/sorter/BlockJoinComparatorSource.java Thu Mar  6 17:03:56 2014
@@ -31,7 +31,16 @@ import org.apache.lucene.util.FixedBitSe
 
 /**
  * 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 e
       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 e
       
       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 e
           }
         } else {
           int cmp = compare(parent1, parent2, parentComparators, parentReverseMul);
-          // nocommit: should not be needed?
           if (cmp == 0) {
             return parent1 - parent2;
           } else {

Modified: lucene/dev/branches/lucene5493/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingAtomicReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5493/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingAtomicReader.java?rev=1574962&r1=1574961&r2=1574962&view=diff
==============================================================================
--- lucene/dev/branches/lucene5493/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingAtomicReader.java (original)
+++ lucene/dev/branches/lucene5493/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingAtomicReader.java Thu Mar  6 17:03:56 2014
@@ -49,13 +49,13 @@ import org.apache.lucene.util.automaton.
 
 /**
  * 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
   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
   }
 
   /** 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));