/** * Returns the docFreq of the current Term in the enumeration. * Returns -1 if no Term matches or all terms have been enumerated. */ public int docFreq() { if (actualEnum == null) return -1; return actualEnum.docFreq(); }
/** * Returns the docFreq of the current Term in the enumeration. * Initially invalid, valid after next() called for the first time. */ public int docFreq() { if (actualEnum == null) return -1; return actualEnum.docFreq(); }
public int docFreq() { if (termEnum==null) return 0; return termEnum.docFreq(); }
public int docFreq() { if (termEnum==null) return 0; return termEnum.docFreq(); }
/** * Returns the docFreq of the current Term in the enumeration. * Returns -1 if no Term matches or all terms have been enumerated. */ public int docFreq() { if (actualEnum == null) return -1; return actualEnum.docFreq(); }
@Override public int docFreq() { return terms.docFreq(); }
public int docFreq() { return tenum.docFreq(); }
public int docFreq() { return in.docFreq(); } public void close() throws IOException { in.close(); }
public int docFreq() { return in.docFreq(); } public void close() throws IOException { in.close(); }
public int docFreq() { return in.docFreq(); } public void close() throws IOException { in.close(); }
public int docFreq() { TermEnum terms = queue.peek(); if (terms != null) { return terms.docFreq(); } return 0; }
public int docFreq() { TermEnum terms = queue.peek(); if (terms != null) { return terms.docFreq(); } return 0; }
@Override public int docFreq() { sanityCheck(); return termEnum.docFreq(); }
@Override public int docFreq() { sanityCheck(); return prefixQueue.element().termEnum.docFreq(); }
protected float calculateWeight(Term term, IndexReader reader) throws IOException { //if a term is not in the index, then it's weight is 0 TermEnum termEnum = reader.terms(term); if (termEnum != null && termEnum.term() != null && termEnum.term().equals(term)) { return 1.0f / termEnum.docFreq(); } else { log.warn("Couldn't find doc freq for term {}", term); return 0; } }
public static void dumpTags(File file, String field, long maxDocs) throws IOException { Directory dir = FSDirectory.open(file); IndexReader reader = IndexReader.open(dir, true); TermEnum te = reader.terms(new Term(field, "")); do { Term term = te.term(); if (term == null || term.field().equals(field) == false) { break; } System.err.printf("%s %d\n", term.text(), te.docFreq()); } while (te.next()); te.close(); }
private int getDocFreq(String term) { int result = 1; currentTerm = currentTerm.createTerm(term); try { TermEnum termEnum = reader.terms(currentTerm); if (termEnum != null && termEnum.term().equals(currentTerm)) { result = termEnum.docFreq(); } } catch (IOException e) { throw new RuntimeException(e); } return result; }
/** dump the terms found in the field specified to the specified writer in the form: * * <pre>term(tab)document_frequency</pre> * * @param indexDir the index to read. * @param field the name of the field. * @param out the print writer output will be written to * @throws IOException */ public static void dumpTerms(File indexDir, String field, PrintWriter out) throws IOException { Directory dir = FSDirectory.open(indexDir); IndexReader reader = IndexReader.open(dir, true); TermEnum te = reader.terms(new Term(field, "")); do { Term term = te.term(); if (term == null || term.field().equals(field) == false) { break; } out.printf("%s %d\n", term.text(), te.docFreq()); } while (te.next()); te.close(); }
public BytesRef next() throws IOException { if (termsEnum != null) { Term actualTerm; do { actualTerm = termsEnum.term(); if (actualTerm == null || actualTerm.field() != field) { return null; } freq = termsEnum.docFreq(); spare.copyChars(actualTerm.text()); termsEnum.next(); return spare; } while(termsEnum.next()); } return null; }
public boolean next() throws IOException { SegmentMergeInfo top = (SegmentMergeInfo)queue.top(); if (top == null) { term = null; return false; } term = top.term; docFreq = 0; while (top != null && term.compareTo(top.term) == 0) { queue.pop(); docFreq += top.termEnum.docFreq(); // increment freq if (top.next()) queue.put(top); // restore queue else top.close(); // done with a segment top = (SegmentMergeInfo)queue.top(); } return true; }