com.browseengine.bobo.util.DocIdSetUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bobo-browse Show documentation
Show all versions of bobo-browse Show documentation
Bobo is a Faceted Search implementation written purely in Java, an extension of Apache Lucene
The newest version!
package com.browseengine.bobo.util;
import java.io.IOException;
import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
public class DocIdSetUtil {
private DocIdSetUtil() {
}
public static String toString(DocIdSet docIdSet) throws IOException {
DocIdSetIterator iter = docIdSet.iterator();
StringBuffer buf = new StringBuffer();
boolean firstTime = true;
buf.append("[");
int docid;
while ((docid = iter.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
if (firstTime) {
firstTime = false;
} else {
buf.append(",");
}
buf.append(docid);
}
buf.append("]");
return buf.toString();
}
}