2 * Copyright (C) 2013 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.cdm
.api
.service
.search
;
11 import java
.io
.IOException
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.apache
.lucene
.search
.DocIdSet
;
15 import org
.apache
.lucene
.search
.DocIdSetIterator
;
18 * Helper class, for printing out information on {@link DocIdSet}s
20 * @author a.kohlbecker
24 public class DocIdBitSetPrinter
{
26 public static final Logger logger
= Logger
.getLogger(DocIdBitSetPrinter
.class);
28 public static String
docsAsString(DocIdSet docset
, int maxdocs
){
30 StringBuilder sb
= new StringBuilder();
32 DocIdSetIterator it
= docset
.iterator();
35 int docId
= it
.nextDoc();
36 if(docId
== DocIdSetIterator
.NO_MORE_DOCS
){
39 sb
.append(docId
).append(" ");
41 } catch (IOException e
) {
42 logger
.error("Error while reding doc ids from DocIdSet", e
);