You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ahmet Arslan <io...@yahoo.com.INVALID> on 2017/08/07 20:41:08 UTC

PostingsEnum for documents that does not contain a term

Hi,
I am traversing posting list of a given term/word using the following code. I am accessing/processing term frequency and document length.
Term term = new Term(field, word);
PostingsEnum postingsEnum = MultiFields.getTermDocsEnum(reader, field, term.bytes());

if (postingsEnum == null) return word + "(stopword)";

while (postingsEnum.nextDoc() != PostingsEnum.NO_MORE_DOCS) {
            final int freq = postingsEnum.freq();
            final long numTerms = norms.get(postingsEnum.docID());
            .......
}

Now I want to traverse the remaining documents. (documents that does *not* contain the term/word)

What is the best way to accomplish this?
Thanks,Ahmet