diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java index 47902067127..4d73eaa3e1b 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java @@ -860,7 +860,7 @@ public final class DirectPostingsFormat extends PostingsFormat { // TODO: implement reuse // it's hairy! - if ((flags & PostingsEnum.POSITIONS) >= PostingsEnum.POSITIONS) { + if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { if (!hasPos) { return null; } @@ -1454,7 +1454,7 @@ public final class DirectPostingsFormat extends PostingsFormat { public PostingsEnum postings(Bits liveDocs, PostingsEnum reuse, int flags) { // TODO: implement reuse // it's hairy! - if ((flags & PostingsEnum.POSITIONS) >= PostingsEnum.POSITIONS) { + if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { if (!hasPos) { return null; } diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java index 7625f5e5f70..ecc70cdfbf7 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java @@ -829,7 +829,7 @@ public final class MemoryPostingsFormat extends PostingsFormat { @Override public PostingsEnum postings(Bits liveDocs, PostingsEnum reuse, int flags) { - if ((flags & PostingsEnum.POSITIONS) >= PostingsEnum.POSITIONS) { + if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { if (field.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0) { return null; } diff --git a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java index 4f986aa74f7..7f2e0f7c2d0 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java @@ -937,7 +937,7 @@ public final class CompressingTermVectorsReader extends TermVectorsReader implem @Override public final PostingsEnum postings(Bits liveDocs, PostingsEnum reuse, int flags) throws IOException { - if ((flags & PostingsEnum.POSITIONS) >= PostingsEnum.POSITIONS) { + if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { if (positions == null && startOffsets == null) return null; } diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java index 6a710a6e69b..4fe53a998bd 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java @@ -194,7 +194,7 @@ public final class Lucene50PostingsReader extends PostingsReaderBase { @Override public PostingsEnum postings(FieldInfo fieldInfo, BlockTermState termState, Bits liveDocs, PostingsEnum reuse, int flags) throws IOException { - if ((flags & PostingsEnum.POSITIONS) < PostingsEnum.POSITIONS) { + if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS) == false) { BlockDocsEnum docsEnum; if (reuse instanceof BlockDocsEnum) { docsEnum = (BlockDocsEnum) reuse; diff --git a/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java b/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java index 07887c2692e..2ffbbb19d99 100644 --- a/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java +++ b/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java @@ -235,7 +235,7 @@ class FreqProxFields extends Fields { throw new IllegalArgumentException("liveDocs must be null"); } - if ((flags & PostingsEnum.POSITIONS) >= PostingsEnum.POSITIONS) { + if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { FreqProxPostingsEnum posEnum; if (!terms.hasProx) {