/** Returns {@link PostingsEnum} for the specified term * with {@link PostingsEnum#FREQS}. * <p> * Use this method if you only require documents and frequencies, * and do not need any proximity data. * This method is equivalent to * {@link #postings(Term, int) postings(term, PostingsEnum.FREQS)} * <p><b>NOTE:</b> The returned {@link PostingsEnum} may contain deleted docs. * @see #postings(Term, int) */ public final PostingsEnum postings(Term term) throws IOException { return postings(term, PostingsEnum.FREQS); }
/** Returns {@link PostingsEnum} for the specified term * with {@link PostingsEnum#FREQS}. * <p> * Use this method if you only require documents and frequencies, * and do not need any proximity data. * This method is equivalent to * {@link #postings(Term, int) postings(term, PostingsEnum.FREQS)} * <p><b>NOTE:</b> The returned {@link PostingsEnum} may contain deleted docs. * @see #postings(Term, int) */ public final PostingsEnum postings(Term term) throws IOException { return postings(term, PostingsEnum.FREQS); }
/** Returns {@link PostingsEnum} for the specified term * with {@link PostingsEnum#FREQS}. * <p> * Use this method if you only require documents and frequencies, * and do not need any proximity data. * This method is equivalent to * {@link #postings(Term, int) postings(term, PostingsEnum.FREQS)} * <p><b>NOTE:</b> The returned {@link PostingsEnum} may contain deleted docs. * @see #postings(Term, int) */ public final PostingsEnum postings(Term term) throws IOException { return postings(term, PostingsEnum.FREQS); }
/** Returns {@link PostingsEnum} for the specified term * with {@link PostingsEnum#FREQS}. * <p> * Use this method if you only require documents and frequencies, * and do not need any proximity data. * This method is equivalent to * {@link #postings(Term, int) postings(term, PostingsEnum.FREQS)} * <p><b>NOTE:</b> The returned {@link PostingsEnum} may contain deleted docs. * @see #postings(Term, int) */ public final PostingsEnum postings(Term term) throws IOException { return postings(term, PostingsEnum.FREQS); }
public PostingsEnum getDocsForTerm(Term term) throws IOException { return this.leafReader.postings(term); }
private static void addDocuments(LeafReader reader, Term term, Collection<Document> documents) throws IOException { PostingsEnum docs = reader.postings(term); if (docs != null) { int docId; while ((docId = docs.nextDoc()) != PostingsEnum.NO_MORE_DOCS) { Bits liveDocs = reader.getLiveDocs(); // Maybe some of the docs have been deleted! Check that too.. if (liveDocs != null && !liveDocs.get(docId)) { continue; } Document document = readDocument(reader, docId, null); documents.add(document); } } }
for ( int i = 0; i < spatialHashCellsIds.size(); i++ ) { Term spatialHashCellTerm = new Term( fieldName, spatialHashCellsIds.get( i ) ); PostingsEnum spatialHashCellsDocs = atomicReader.postings( spatialHashCellTerm ); if ( spatialHashCellsDocs != null ) { while ( true ) {
private static Document getDocument(LeafReader reader, Term term) throws IOException { PostingsEnum docs = reader.postings(term); if (docs != null) { int docId = docs.nextDoc(); // PostingsEnum may contain deleted documents, we have to cope for it while (docId != PostingsEnum.NO_MORE_DOCS) { // if document is deleted, skip and continue Bits liveDocs = reader.getLiveDocs(); if (liveDocs != null && !liveDocs.get(docId)) { docId = docs.nextDoc(); continue; } if (docs.nextDoc() != PostingsEnum.NO_MORE_DOCS) { throw new IllegalStateException("Multiple Documents for term " + term.text()); } return readDocument(reader, docId, null); } } return null; }
for ( int i = 0; i < spatialHashCellsIds.size(); i++ ) { Term spatialHashCellTerm = new Term( fieldName, spatialHashCellsIds.get( i ) ); PostingsEnum spatialHashCellsDocs = atomicReader.postings( spatialHashCellTerm ); if ( spatialHashCellsDocs != null ) { while ( true ) {
private static DocIdSet liveDocsBitSet(LeafReader reader, Term term) throws IOException { FixedBitSet bitSet = new FixedBitSet(reader.maxDoc()); Bits liveDocs = reader.getLiveDocs(); PostingsEnum termDocs = reader.postings(term); long setSize = 0; while (termDocs.nextDoc() != NO_MORE_DOCS) { int docID = termDocs.docID(); if (liveDocs == null || liveDocs.get(docID)) { bitSet.set(docID); ++setSize; // else document is deleted... } } return new BitDocIdSet(bitSet, setSize); } }