/** * Returns a String representation of the index data for debugging purposes. * * @return the string representation */ @Override public String toString() { StringBuilder result = new StringBuilder(256); sortFields(); int sumPositions = 0; int sumTerms = 0; final BytesRef spare = new BytesRef(); for (int i=0; i < sortedFields.length; i++) { Map.Entry<String,Info> entry = sortedFields[i]; String fieldName = entry.getKey(); Info info = entry.getValue(); info.sortTerms(); result.append(fieldName + ":\n"); SliceByteStartArray sliceArray = info.sliceArray; int numPositions = 0; SliceReader postingsReader = new SliceReader(intBlockPool); for (int j=0; j < info.terms.size(); j++) { int ord = info.sortedTerms[j]; info.terms.get(ord, spare); int freq = sliceArray.freq[ord]; result.append("\t'" + spare + "':" + freq + ":"); postingsReader.reset(sliceArray.start[ord], sliceArray.end[ord]); result.append(" ["); final int iters = storeOffsets ? 3 : 1; while(!postingsReader.endOfSlice()) { result.append("("); for (int k = 0; k < iters; k++) { result.append(postingsReader.readInt()); if (k < iters-1) { result.append(", "); } } result.append(")"); if (!postingsReader.endOfSlice()) { result.append(","); } } result.append("]"); result.append("\n"); numPositions += freq; } result.append("\tterms=" + info.terms.size()); result.append(", positions=" + numPositions); result.append("\n"); sumPositions += numPositions; sumTerms += info.terms.size(); } result.append("\nfields=" + sortedFields.length); result.append(", terms=" + sumTerms); result.append(", positions=" + sumPositions); return result.toString(); }
public MemoryDocsAndPositionsEnum() { this.sliceReader = new SliceReader(intBlockPool); }
/** * Returns a String representation of the index data for debugging purposes. * * @return the string representation */ @Override public String toString() { StringBuilder result = new StringBuilder(256); sortFields(); int sumPositions = 0; int sumTerms = 0; final BytesRef spare = new BytesRef(); for (int i=0; i < sortedFields.length; i++) { Map.Entry<String,Info> entry = sortedFields[i]; String fieldName = entry.getKey(); Info info = entry.getValue(); info.sortTerms(); result.append(fieldName + ":\n"); SliceByteStartArray sliceArray = info.sliceArray; int numPositions = 0; SliceReader postingsReader = new SliceReader(intBlockPool); for (int j=0; j < info.terms.size(); j++) { int ord = info.sortedTerms[j]; info.terms.get(ord, spare); int freq = sliceArray.freq[ord]; result.append("\t'" + spare + "':" + freq + ":"); postingsReader.reset(sliceArray.start[ord], sliceArray.end[ord]); result.append(" ["); final int iters = storeOffsets ? 3 : 1; while(!postingsReader.endOfSlice()) { result.append("("); for (int k = 0; k < iters; k++) { result.append(postingsReader.readInt()); if (k < iters-1) { result.append(", "); } } result.append(")"); if (!postingsReader.endOfSlice()) { result.append(","); } } result.append("]"); result.append("\n"); numPositions += freq; } result.append("\tterms=" + info.terms.size()); result.append(", positions=" + numPositions); result.append(", memory=" + RamUsageEstimator.humanReadableUnits(RamUsageEstimator.sizeOf(info))); result.append("\n"); sumPositions += numPositions; sumTerms += info.terms.size(); } result.append("\nfields=" + sortedFields.length); result.append(", terms=" + sumTerms); result.append(", positions=" + sumPositions); result.append(", memory=" + RamUsageEstimator.humanReadableUnits(getMemorySize())); return result.toString(); }