/** * @param field Index field for which number of indexed documents are to be return * @return number of indexed documents (without subtracting potentially deleted ones) * for the given {@code field}.<br> * -1: if index codec doesn't store doc-count-for-field statistics, OR <br> * reader threw an exception while reading fields, OR <br> * exception thrown while reading count for the field, OR <br> * doc-count is asked for a non-property field. */ public int getDocCountFor(String field) { if (!safelyInitialized) { return -1; } int docCntForField = isPropertyField(field) ? 0 : -1; if (numDocsForField.containsKey(field)) { docCntForField = numDocsForField.get(field); } return docCntForField; }
/** * @param field Index field for which number of indexed documents are to be return * @return number of indexed documents (without subtracting potentially deleted ones) * for the given {@code field}.<br> * -1: if index codec doesn't store doc-count-for-field statistics, OR <br> * reader threw an exception while reading fields, OR <br> * exception thrown while reading count for the field, OR <br> * doc-count is asked for a non-property field. */ public int getDocCountFor(String field) { if (!safelyInitialized) { return -1; } int docCntForField = isPropertyField(field) ? 0 : -1; if (numDocsForField.containsKey(field)) { docCntForField = numDocsForField.get(field); } return docCntForField; }
if (isPropertyField(f)) { int docCntForField = -1; try {
if (isPropertyField(f)) { int docCntForField = -1; try {
private void assertPropertyFieldName(String name, boolean expected) { Assert.assertEquals("Check for field name " + name + " doesn't meet expectation - " + expected, FieldNames.isPropertyField(name), expected); } }