lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1524580 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/search/ lucene/expressions/ lucene/expressions/src/java/org/apache/lucene/expressions/
Date Wed, 18 Sep 2013 21:31:49 GMT
Author: rmuir
Date: Wed Sep 18 21:31:48 2013
New Revision: 1524580

URL: http://svn.apache.org/r1524580
Log:
LUCENE-5222: fix expression sort with executorService

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/Sort.java
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/SortField.java
    lucene/dev/branches/branch_4x/lucene/expressions/   (props changed)
    lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionSortField.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/Sort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/Sort.java?rev=1524580&r1=1524579&r2=1524580&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/Sort.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/Sort.java
Wed Sep 18 21:31:48 2013
@@ -205,7 +205,7 @@ public class Sort {
   /** Whether the relevance score is needed to sort documents. */
   boolean needsScores() {
     for (SortField sortField : fields) {
-      if (sortField.getType() == SortField.Type.SCORE) {
+      if (sortField.needsScores()) {
         return true;
       }
     }

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/SortField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/SortField.java?rev=1524580&r1=1524579&r2=1524580&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/SortField.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/SortField.java
Wed Sep 18 21:31:48 2013
@@ -428,4 +428,9 @@ public class SortField {
   public SortField rewrite(IndexSearcher searcher) throws IOException {
     return this;
   }
+  
+  /** Whether the relevance score is needed to sort documents. */
+  public boolean needsScores() {
+    return type == Type.SCORE;
+  }
 }

Modified: lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionSortField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionSortField.java?rev=1524580&r1=1524579&r2=1524580&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionSortField.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionSortField.java
Wed Sep 18 21:31:48 2013
@@ -35,4 +35,9 @@ class ExpressionSortField extends SortFi
   public FieldComparator<?> getComparator(final int numHits, final int sortPos) throws
IOException {
     return new ExpressionComparator(source, numHits);
   }
+
+  @Override
+  public boolean needsScores() {
+    return true; // TODO: maybe we can optimize by "figuring this out" somehow...
+  }
 }
\ No newline at end of file



Mime
View raw message