incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/4] git commit: Class now compiles, needs to be tested to know if it works.
Date Tue, 16 Oct 2012 01:40:45 GMT
Class now compiles, needs to be tested to know if it works.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/91080835
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/91080835
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/91080835

Branch: refs/heads/lucene-4.0.0
Commit: 910808354e69307e1b1cc20a5c404730c78cc878
Parents: 5c2eebd
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Oct 15 21:30:35 2012 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Oct 15 21:30:35 2012 -0400

----------------------------------------------------------------------
 .../java/org/apache/blur/utils/PrimeDocCache.java  |   38 +++++++++++---
 1 files changed, 30 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/91080835/src/blur-core/src/main/java/org/apache/blur/utils/PrimeDocCache.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/utils/PrimeDocCache.java b/src/blur-core/src/main/java/org/apache/blur/utils/PrimeDocCache.java
index 4ca0e7d..f10502d 100644
--- a/src/blur-core/src/main/java/org/apache/blur/utils/PrimeDocCache.java
+++ b/src/blur-core/src/main/java/org/apache/blur/utils/PrimeDocCache.java
@@ -22,9 +22,13 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
+import org.apache.lucene.index.AtomicReaderContext;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.ReaderClosedListener;
-import org.apache.lucene.index.TermDocs;
+import org.apache.lucene.search.Collector;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Scorer;
+import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.util.OpenBitSet;
 
 
@@ -54,13 +58,31 @@ public class PrimeDocCache {
         }
       });
       LOG.debug("Prime Doc BitSet missing for segment [" + reader + "] current size [" +
primeDocMap.size() + "]");
-      bitSet = new OpenBitSet(reader.maxDoc());
-      primeDocMap.put(key, bitSet);
-      TermDocs termDocs = reader.termDocs(BlurConstants.PRIME_DOC_TERM);
-      while (termDocs.next()) {
-        bitSet.set(termDocs.doc());
-      }
-      termDocs.close();
+      final OpenBitSet bs = new OpenBitSet(reader.maxDoc());
+      primeDocMap.put(key, bs);
+      IndexSearcher searcher = new IndexSearcher(reader);
+      searcher.search(new TermQuery(BlurConstants.PRIME_DOC_TERM), new Collector() {
+        
+        @Override
+        public void setScorer(Scorer scorer) throws IOException {
+          
+        }
+        
+        @Override
+        public void setNextReader(AtomicReaderContext atomicReaderContext) throws IOException
{
+        }
+        
+        @Override
+        public void collect(int doc) throws IOException {
+          bs.set(doc);
+        }
+        
+        @Override
+        public boolean acceptsDocsOutOfOrder() {
+          return false;
+        }
+      });
+      return bs;
     }
     return bitSet;
   }


Mime
View raw message