code: public void set(int doc)
     {
        hits.set(doc);
        docCount++;
        if (doc > maxDoc)
        {
           maxDoc = doc;
        }
  
        if (docCount > threshold && (hits instanceof ArrayHits))
        {
           int intArraySize = docCount * 4;
           int bitSetSize = maxDoc / 8;
           if (bitSetSize < intArraySize)
           {
              log.debug("BitSet is smaller than int[]: " + bitSetSize + " vs " + intArraySize);
              BitSetHits bitSetHits = new BitSetHits();
              int i = 0;
              while (i > -1)
              {
                 try
                 {
                    i = hits.next();
                    if (i > -1)
                    {
                       bitSetHits.set(i);
                    }
                 }
                 catch (IOException e)
                 {
                    throw new RuntimeException(e);
                 }
              }
              hits = bitSetHits;
           }
        }
     }
docs: {@inheritDoc}