Revision: 17342
http://sourceforge.net/p/gate/code/17342
Author: valyt
Date: 2014-02-19 14:45:47 +0000 (Wed, 19 Feb 2014)
Log Message:
-----------
When counting things it helps to count the right things, and all of them.
Modified Paths:
--------------
mimir/branches/5.0/mimir-core/src/gate/mimir/index/AtomicIndex.java
Modified: mimir/branches/5.0/mimir-core/src/gate/mimir/index/AtomicIndex.java
===================================================================
--- mimir/branches/5.0/mimir-core/src/gate/mimir/index/AtomicIndex.java
2014-02-19 13:53:42 UTC (rev 17341)
+++ mimir/branches/5.0/mimir-core/src/gate/mimir/index/AtomicIndex.java
2014-02-19 14:45:47 UTC (rev 17342)
@@ -1832,7 +1832,15 @@
public long getDirectTermOccurenceCount(long directTermId) throws
IOException {
String termStr = directTerms.get(directTermId);
- return invertedIndex.documents(termStr).count();
+ // we need to sum up all the counts for this term in the inverted index
+ long count = 0;
+ IndexIterator idxItr = invertedIndex.documents(termStr);
+ long docId = idxItr.nextDocument();
+ while(docId != IndexIterator.END_OF_LIST) {
+ count += idxItr.count();
+ docId = idxItr.nextDocument();
+ }
+ return count;
}
/**
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs