File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/search Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -79,15 +79,20 @@ public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
79
79
}
80
80
DocSets .or (res , disi );
81
81
}
82
- }
83
82
84
- // if no should clauses match, return null (act as min_should_match set to 1)
85
- if (res == null ) {
86
- return null ;
83
+ // if no should clauses match, return null (act as min_should_match set to 1)
84
+ if (res == null && !shouldFilters .isEmpty ()) {
85
+ return null ;
86
+ }
87
87
}
88
88
89
+
89
90
if (notFilters != null ) {
90
91
for (int i = 0 ; i < notFilters .size (); i ++) {
92
+ if (res == null ) {
93
+ res = new FixedBitSet (reader .maxDoc ());
94
+ res .set (0 , reader .maxDoc ()); // NOTE: may set bits on deleted docs
95
+ }
91
96
final DocIdSet disi = getDISI (notFilters , i , reader );
92
97
if (disi != null ) {
93
98
DocSets .andNot (res , disi );
@@ -101,7 +106,12 @@ public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
101
106
if (disi == null ) {
102
107
return null ;
103
108
}
104
- DocSets .and (res , disi );
109
+ if (res == null ) {
110
+ res = new FixedBitSet (reader .maxDoc ());
111
+ DocSets .or (res , disi );
112
+ } else {
113
+ DocSets .and (res , disi );
114
+ }
105
115
}
106
116
}
107
117
You can’t perform that action at this time.
0 commit comments