@Override public BytesRef term() throws IOException { return tenum.term(); }
TermAndState(String field, TermsEnum termsEnum) throws IOException { this.field = field; this.termsEnum = termsEnum; this.term = BytesRef.deepCopyOf(termsEnum.term()); this.state = termsEnum.termState(); this.docFreq = termsEnum.docFreq(); this.totalTermFreq = termsEnum.totalTermFreq(); } }
@Override public BytesRef term() throws IOException { return actualEnum.term(); }
@Override public BytesRef term() throws IOException { return in.term(); }
@Override public BytesRef lookupOrd(int ord) throws IOException { termsEnum.seekExact(ord); return termsEnum.term(); }
@Override public BytesRef lookupOrd(long ord) throws IOException { termsEnum.seekExact(ord); return termsEnum.term(); }
public void listTokens(int freq) throws IOException { IndexReader ireader = null; TermsEnum iter = null; Terms terms; try { ireader = DirectoryReader.open(indexDirectory); int numDocs = ireader.numDocs(); if (numDocs > 0) { Fields uFields = MultiFields.getFields(ireader);//reader.getTermVectors(0); terms = uFields.terms(QueryBuilder.DEFS); iter = terms.iterator(); // init uid iterator } while (iter != null && iter.term() != null) { //if (iter.term().field().startsWith("f")) { if (iter.docFreq() > 16 && iter.term().utf8ToString().length() > freq) { LOGGER.warning(iter.term().utf8ToString()); } BytesRef next = iter.next(); if (next==null) {iter=null;} } } finally { if (ireader != null) { try { ireader.close(); } catch (IOException e) { LOGGER.log(Level.WARNING, "An error occurred while closing index reader", e); } } } }
/** * Remove a stale file (uidIter.term().text()) from the index database and * history cache, and queue the removal of xref. * * @param removeHistory if false, do not remove history cache for this file * @throws java.io.IOException if an error occurs */ private void removeFile(boolean removeHistory) throws IOException { String path = Util.uid2url(uidIter.term().utf8ToString()); for (IndexChangedListener listener : listeners) { listener.fileRemove(path); } writer.deleteDocuments(new Term(QueryBuilder.U, uidIter.term())); removeXrefFile(path); if (removeHistory) { removeHistoryFile(path); } setDirty(); for (IndexChangedListener listener : listeners) { listener.fileRemoved(path); } }
while (uidIter != null && uidIter.term() != null && uidIter.term().compareTo(emptyBR) != 0 && uidIter.term().compareTo(buid) < 0) { String termPath = Util.uid2url(uidIter.term().utf8ToString()); removeFile(!termPath.equals(path)); if (uidIter != null && uidIter.term() != null && uidIter.term().bytesEquals(buid)) {
actualTerm = tenum.term();
term = termsEnum.next(); } else { term = termsEnum.term();
current = currentSubs[i].current = currentSubs[i].terms.term(); assert term.equals(currentSubs[i].current);
throw new RuntimeException("seek to last term " + lastTerm.get() + " failed"); if (termsEnum.term().equals(lastTerm.get()) == false) { throw new RuntimeException("seek to last term " + lastTerm.get() + " returned FOUND but seeked to the wrong term " + termsEnum.term()); throw new RuntimeException("seek to ord " + ord + " returned ord " + actualOrd); seekTerms[i] = BytesRef.deepCopyOf(termsEnum.term()); throw new RuntimeException("seek to existing term " + seekTerms[i] + " failed"); if (termsEnum.term().equals(seekTerms[i]) == false) { throw new RuntimeException("seek to existing term " + seekTerms[i] + " returned FOUND but seeked to the wrong term " + termsEnum.term());
readerTerm = termsEnum.term(); continue; } else {
startTerm(termsEnum.term(), freq);
writer.startTerm(termsEnum.term(), freq);
TermsEnum iterator = iterator(); iterator.seekExact(size - 1); return iterator.term(); } catch (UnsupportedOperationException e) {