[jsword-svn] r1524 - trunk/jsword/src/main/java/org/crosswire/jsword/index/query
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Tue Jul 24 14:21:47 MST 2007
Author: dmsmith
Date: 2007-07-24 14:21:47 -0700 (Tue, 24 Jul 2007)
New Revision: 1524
Modified:
trunk/jsword/src/main/java/org/crosswire/jsword/index/query/AndQuery.java
trunk/jsword/src/main/java/org/crosswire/jsword/index/query/OrQuery.java
Log:
Fixed a bug that prevented range queries from being prioritized.
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/query/AndQuery.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/query/AndQuery.java 2007-07-24 20:51:33 UTC (rev 1523)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/query/AndQuery.java 2007-07-24 21:21:47 UTC (rev 1524)
@@ -24,6 +24,7 @@
import org.crosswire.jsword.book.BookException;
import org.crosswire.jsword.index.Index;
import org.crosswire.jsword.passage.Key;
+import org.crosswire.jsword.passage.PassageTally;
/**
* An AND query specifies that a result needs to be in both the left and the right query results.
@@ -64,8 +65,14 @@
return right;
}
+ // If ranking was requested then prioritize it.
+ if (right instanceof PassageTally)
+ {
+ right.retainAll(left);
+ return right;
+ }
+
left.retainAll(right);
-
return left;
}
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/query/OrQuery.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/query/OrQuery.java 2007-07-24 20:51:33 UTC (rev 1523)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/query/OrQuery.java 2007-07-24 21:21:47 UTC (rev 1524)
@@ -24,6 +24,7 @@
import org.crosswire.jsword.book.BookException;
import org.crosswire.jsword.index.Index;
import org.crosswire.jsword.passage.Key;
+import org.crosswire.jsword.passage.PassageTally;
/**
* An OR query specifies that a result is the union of the left and the right query results.
@@ -61,6 +62,13 @@
return left;
}
+ // If ranking was requested then prioritize it.
+ if (right instanceof PassageTally)
+ {
+ right.addAll(left);
+ return right;
+ }
+
left.addAll(right);
return left;
More information about the jsword-svn
mailing list