List of usage examples for org.apache.solr.search SolrIndexSearcher docFreq
public final int docFreq(Term term) throws IOException
From source file:com.lucid.solr.sidecar.SidecarIndexReaderFactory.java
License:Apache License
private Document lookup(SolrIndexSearcher lookup, String id, BytesRef idRef, Set<String> fields) throws IOException { idRef.copyChars(id);//from ww w . ja va2s. com Term t = new Term("id", idRef); if (lookup.docFreq(t) == 0) { return null; } int docId = lookup.getFirstMatch(t); if (docId == -1) { return null; } Document doc = lookup.doc(docId, fields); if (doc == null) { return null; } doc.removeFields("id"); return doc; }