Revision: 17205
http://sourceforge.net/p/gate/code/17205
Author: valyt
Date: 2013-12-23 16:18:08 +0000 (Mon, 23 Dec 2013)
Log Message:
-----------
Some very simple code that searches an AtomicIndex while adding documents to it
at the same time.
Modified Paths:
--------------
mimir/branches/5.0/mimir-test/src/gate/mimir/test/Scratch.java
Modified: mimir/branches/5.0/mimir-test/src/gate/mimir/test/Scratch.java
===================================================================
--- mimir/branches/5.0/mimir-test/src/gate/mimir/test/Scratch.java
2013-12-23 16:16:04 UTC (rev 17204)
+++ mimir/branches/5.0/mimir-test/src/gate/mimir/test/Scratch.java
2013-12-23 16:18:08 UTC (rev 17205)
@@ -10,6 +10,7 @@
import it.unimi.di.big.mg4j.index.Index;
import it.unimi.di.big.mg4j.index.IndexIterator;
import it.unimi.di.big.mg4j.index.IndexReader;
+import it.unimi.di.big.mg4j.search.DocumentIterator;
import it.unimi.di.big.mg4j.search.score.BM25FScorer;
import it.unimi.di.big.mg4j.search.score.BM25Scorer;
import it.unimi.di.big.mg4j.search.score.CountScorer;
@@ -230,7 +231,7 @@
inputQueue, outputQueue,
indexConfig.getTokenIndexers()[0],
false);
- ati.setOccurrencesPerBatch(5000000);
+ ati.setOccurrencesPerBatch(500000);
File zipFile = new File(args[1]);
String fileURI = zipFile.toURI().toString();
ZipFile zip = new ZipFile(args[1]);
@@ -248,7 +249,22 @@
GATEDocument gateDoc = new GATEDocument(doc, indexConfig);
inputQueue.put(gateDoc);
}
+ // now let's do some searches
+ Index index = ati.getIndex();
+ int resDocs = 0;
+ if(index != null) {
+ IndexIterator indexIter = index.getReader().documents("patent");
+ long docId = indexIter.nextDocument();
+ while(docId != DocumentIterator.END_OF_LIST) {
+ resDocs ++;
+ docId = indexIter.nextDocument();
+ }
+ }
+ System.out.println("=================================\n" +
+ "Matched " + resDocs + " documents.\n" +
+ "=================================\n");
}
+
ati.close();
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs