int[] results = new int[hits];
//If the lenght of the query is one, just return the first n documents
//in the postings list.
if(query.length == 1) {
CompressedPostings ps = postings[query[0]];
int df = dfs[query[0]];
if(hits > df) {
hits = df;
}
int nbBlocks = ps.getBlockCount();
int cnt = 0;
for(int i = 0; i < nbBlocks; i++) {
int bSize = ps.decompressBlock(decomp, i);
int docno = 0;
for(int j = 0; j < bSize; j++) {
docno += decomp[j];
results[cnt] = docno;
cnt++;
if(cnt >= hits) {
return results;
}
}
}
return results;
}
//Find the minimum Df value
int minDf = Integer.MAX_VALUE;
int indexOfMinDf = -1;
for (int i = 0; i < query.length; i++) {
int df = dfs[query[i]];
if (df < minDf) {
minDf = df;
indexOfMinDf = i;
}
}
//Prepare a list of signatures to perform membership tests against
Signature[] list = new Signature[query.length - 1];
int pos = 0;
for (int i = 0; i < query.length; i++) {
if(i != indexOfMinDf) {
list[pos] = filters[query[i]];
pos++;
}
}
CompressedPostings ps = postings[query[indexOfMinDf]];
int cnt = 0;
int nbBlocks = ps.getBlockCount();
for (int i = 0; i < nbBlocks; i++) {
int bSize = ps.decompressBlock(decomp, i);
int docno = 0;
boolean pick = true;
for(int j = 0; j < bSize; j++) {
docno += decomp[j];