Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

switch to openbitset

  • Loading branch information...
commit d80330920533ef65595ecbd8143f4bf43b557dcd 1 parent 97079db
@tjake authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/lucandra/LucandraAllTermDocs.java
View
12 src/lucandra/LucandraAllTermDocs.java
@@ -33,6 +33,7 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs;
import org.apache.lucene.index.TermEnum;
+import org.apache.lucene.util.OpenBitSet;
public class LucandraAllTermDocs implements TermDocs
{
@@ -41,7 +42,7 @@
private String indexName;
private int idx; // tracks where we are in the doc buffer
private int fillSize; // tracks how much the buffer was filled with docs from cassandra
- private int[] docBuffer = new int[CassandraIndexManager.maxDocsPerShard+1]; // max number of docs we pull
+ private OpenBitSet docBuffer = new OpenBitSet(CassandraIndexManager.maxDocsPerShard+1); // max number of docs we pull
private int doc = -1;
private int maxDoc;
@@ -49,7 +50,6 @@ public LucandraAllTermDocs(IndexReader indexReader)
{
indexName = indexReader.getIndexName();
maxDoc = indexReader.maxDoc();
- Arrays.fill(docBuffer, 0);
idx = 0;
fillSize = 0;
@@ -106,8 +106,8 @@ public int read(int[] docs, int[] freqs) throws IOException
while (i < length && doc < maxDoc && fillSize > 0)
{
- docs[i] = doc;
- freqs[i] = docBuffer[doc];
+ docs[i] = doc;
+ freqs[i] = docBuffer.getBit(doc);
++i;
next();
@@ -120,7 +120,7 @@ public boolean skipTo(int target) throws IOException
doc = target;
for (; idx < maxDoc; idx++)
{
- if (idx >= doc && docBuffer[idx] > 0){
+ if (idx >= doc && docBuffer.getBit(idx) > 0){
doc = idx;
return true;
}
@@ -164,7 +164,7 @@ private void fillDocBuffer() throws IOException
{
//valid id
if( !(c instanceof ExpiringColumn)){
- docBuffer[id] = 1;
+ docBuffer.set(id);
fillSize++;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.