@Override public final int getDocCount(String field) throws IOException { ensureOpen(); int total = 0; // sum doc counts in subreaders for (R reader : subReaders) { int sub = reader.getDocCount(field); if (sub == -1) { return -1; // if any of the subs doesn't support it, return -1 } total += sub; } return total; }
public long countDocuments() throws IOException { return reader.getDocCount(defaultField); }
/** * Creates a constant value source returning the docCount for a given field * * @see IndexReader#getDocCount(String) */ public static DoubleValuesSource docCount(String field) { return new IndexReaderDoubleValuesSource(r -> r.getDocCount(field), "docCount(" + field + ")"); }
@Override public final int getDocCount(String field) throws IOException { ensureOpen(); int total = 0; // sum doc counts in subreaders for (R reader : subReaders) { int sub = reader.getDocCount(field); if (sub == -1) { return -1; // if any of the subs doesn't support it, return -1 } total += sub; } return total; }
@Override public final int getDocCount(String field) throws IOException { ensureOpen(); int total = 0; // sum doc counts in subreaders for (R reader : subReaders) { int sub = reader.getDocCount(field); if (sub == -1) { return -1; // if any of the subs doesn't support it, return -1 } total += sub; } return total; }
@Override public final int getDocCount(String field) throws IOException { ensureOpen(); int total = 0; // sum doc counts in subreaders for (R reader : subReaders) { int sub = reader.getDocCount(field); if (sub == -1) { return -1; // if any of the subs doesn't support it, return -1 } total += sub; } return total; }
private static ArrayList<String> getFieldInfo(String path, IndexSearcher searcher) throws IOException { ArrayList<String> list = new ArrayList<String>(); IndexReader reader = searcher.getIndexReader(); Fields fields = MultiFields.getFields(reader); if (fields != null) { for(String f : fields) { list.add(path + " " + f + " " + reader.getDocCount(f)); } } return list; }
private static ArrayList<String> getFieldInfo(String path, IndexSearcher searcher) throws IOException { ArrayList<String> list = new ArrayList<String>(); IndexReader reader = searcher.getIndexReader(); Fields fields = MultiFields.getFields(reader); if (fields != null) { for(String f : fields) { list.add(path + " " + f + " " + reader.getDocCount(f)); } } return list; }
File tempSubChild = new File(tempDir, "non-existing-sub-child"); if (reader.getDocCount(FieldNames.SUGGEST) > 0) { Dictionary dictionary = new LuceneDictionary(reader, FieldNames.SUGGEST); AnalyzingInfixSuggester suggester = closer.register(getLookup(directory, analyzer, tempSubChild));
reader = searcher.getIndexReader(); int availableDocsCnt = reader.getDocCount(this.field); if (this.deterministic) { // internal docid cannot be relied due to multi-threads indexing,
throw new IOException("Synthetically fail to read count for field jcr:title"); docCntForField = reader.getDocCount(f); } catch (IOException e) { LOG.warn("Couldn't read doc count for field {} via reader ({}).");
throw new IOException("Synthetically fail to read count for field jcr:title"); docCntForField = reader.getDocCount(f); } catch (IOException e) { LOG.warn("Couldn't read doc count for field {} via reader ({}).");
File tempSubChild = new File(tempDir, "non-existing-sub-child"); if (reader.getDocCount(FieldNames.SUGGEST) > 0) { Dictionary dictionary = new LuceneDictionary(reader, FieldNames.SUGGEST); AnalyzingInfixSuggester suggester = closer.register(getLookup(directory, analyzer, tempSubChild));
double t = (double) indexReader.getSumTotalTermFreq(textFieldName) / (double) indexReader.getDocCount(textFieldName); if (t != -1) { this.bias = t;
final double avgDocLength = 1.0d * reader.getSumTotalTermFreq(fieldToQuery) / reader.getDocCount(fieldToQuery);
"field", indexReader.maxDoc(), indexReader.getDocCount(fieldName), indexReader.getSumTotalTermFreq(fieldName), indexReader.getSumDocFreq(fieldName)
if (field.charAt(0) == '_') continue; xml.openElement("field"); xml.attribute("documents", reader.getDocCount(field)); xml.writeText(field); xml.closeElement();