Revision: 14756
http://gate.svn.sourceforge.net/gate/?rev=14756&view=rev
Author: valyt
Date: 2011-12-13 14:48:17 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
Fixed some bugs caused by using document indexes instead of document ranks.
Modified Paths:
--------------
mimir/trunk/mimir-core/src/gate/mimir/search/RankingQueryRunnerImpl.java
Modified:
mimir/trunk/mimir-core/src/gate/mimir/search/RankingQueryRunnerImpl.java
===================================================================
--- mimir/trunk/mimir-core/src/gate/mimir/search/RankingQueryRunnerImpl.java
2011-12-13 13:07:38 UTC (rev 14755)
+++ mimir/trunk/mimir-core/src/gate/mimir/search/RankingQueryRunnerImpl.java
2011-12-13 14:48:17 UTC (rev 14756)
@@ -95,7 +95,14 @@
* This is the only actor that writes to the {@link #documentHits} list.
*/
protected class HitsCollector implements Runnable {
+ /**
+ * The starting rank
+ */
int start;
+
+ /**
+ * The ending rank
+ */
int end;
public HitsCollector(int rangeStart, int rangeEnd) {
@@ -277,7 +284,8 @@
/**
* The sets of hits for each returned document. This data structure is
lazily
- * built, so some elements may be null.
+ * built, so some elements may be null. This list is aligned to
+ * {@link #documentIds}.
*/
protected ObjectList<List<Binding>> documentHits;
@@ -403,7 +411,7 @@
try {
// find the Future working on it, or start a new one,
// then wait for it to complete
- collectHits(new int[]{documentIndex, documentIndex + 1}).get();
+ collectHits(new int[]{rank, rank + 1}).get();
hits = documentHits.get(documentIndex);
} catch(Exception e) {
logger.error("Exception while waiting for hits collection", e);
@@ -559,28 +567,24 @@
// expand the interval to block size
if(interval[1] - interval[0] < docBlockSize) {
interval[0] -= docBlockSize / 2;
- interval[1] += docBlockSize / 2;
+ if(interval[0] < 0)interval[0] = 0;
+ interval[1] = interval[0] + docBlockSize;
}
HitsCollector hitsCollector = null;
synchronized(hitCollectors) {
SortedMap<int[], Future<?>> headMap = hitCollectors.headMap(interval);
- int[] previousInterval = headMap.isEmpty() ? new int[]{0,0} :
+ int[] previousInterval = headMap.isEmpty() ? new int[]{0, 0} :
headMap.lastKey();
if(previousInterval[1] >= interval[1]) {
// we're part of previous interval
return hitCollectors.get(previousInterval);
} else {
// calculate an appropriate interval to collect hits for
- SortedMap<int[], Future<?>> tailMap = hitCollectors.tailMap(interval);
- int[] followingInterval;
- if(tailMap.isEmpty()) {
- int maxBoundary = (documentsOrder != null) ?
- documentsOrder.size() : interval[1] + docBlockSize / 2;
- followingInterval = new int[]{maxBoundary, maxBoundary};
- } else {
- followingInterval = tailMap.firstKey();
- }
- int start = Math.max(previousInterval[1], interval[0]);
+ SortedMap<int[], Future<?>> tailMap = hitCollectors.tailMap(
+ new int[]{interval[1], interval[1]});
+ int[] followingInterval = tailMap.isEmpty() ?
+ new int[]{interval[1], interval[1]} : tailMap.firstKey();
+ int start = Math.max(previousInterval[1] - 1, interval[0]);
int end = Math.min(followingInterval[0], interval[1]);
hitsCollector = new HitsCollector(start, end);
FutureTask<?> future = new FutureTask<Object>(hitsCollector, null);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and
improve service delivery. Take 5 minutes to use this Systems Optimization
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs