| Nils Diewald | ea96950 | 2015-02-16 21:10:54 +0000 | [diff] [blame] | 1 | package de.ids_mannheim.korap.collection; |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 2 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 3 | import java.util.*; |
| 4 | import java.io.IOException; |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 5 | |
| 6 | import org.apache.lucene.index.Term; |
| 7 | import org.apache.lucene.queries.TermsFilter; |
| 8 | import org.apache.lucene.search.*; |
| 9 | import org.apache.lucene.search.NumericRangeFilter; |
| Nils Diewald | c383ed0 | 2015-02-26 21:35:22 +0000 | [diff] [blame] | 10 | import de.ids_mannheim.korap.util.KrillDate; |
| Nils Diewald | fb4d7b0 | 2014-04-09 17:56:17 +0000 | [diff] [blame] | 11 | |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 12 | import org.slf4j.Logger; |
| 13 | import org.slf4j.LoggerFactory; |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 14 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 15 | import de.ids_mannheim.korap.KrillCollection; |
| 16 | import de.ids_mannheim.korap.collection.BooleanGroupFilter; |
| 17 | |
| Akron | aa74ec6 | 2015-07-31 17:22:55 +0200 | [diff] [blame] | 18 | /* |
| 19 | * TODO: Optimize! |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 20 | * - Remove identical object in Boolean groups |
| Akron | aa74ec6 | 2015-07-31 17:22:55 +0200 | [diff] [blame] | 21 | * - Flatten boolean groups |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 22 | * - create "between" ranges for multiple date objects |
| Akron | aa74ec6 | 2015-07-31 17:22:55 +0200 | [diff] [blame] | 23 | */ |
| 24 | |
| Nils Diewald | ea96950 | 2015-02-16 21:10:54 +0000 | [diff] [blame] | 25 | public class CollectionBuilder { |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 26 | |
| 27 | // Logger |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 28 | private final static Logger log = LoggerFactory |
| 29 | .getLogger(KrillCollection.class); |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 30 | |
| Nils Diewald | fb4d7b0 | 2014-04-09 17:56:17 +0000 | [diff] [blame] | 31 | // This advices the java compiler to ignore all loggings |
| 32 | public static final boolean DEBUG = false; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 33 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 34 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 35 | public CollectionBuilder.Interface term (String field, String term) { |
| 36 | return new CollectionBuilder.Term(field, term); |
| Nils Diewald | fb4d7b0 | 2014-04-09 17:56:17 +0000 | [diff] [blame] | 37 | }; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 38 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 39 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 40 | public CollectionBuilder.Interface re (String field, String term) { |
| 41 | return new CollectionBuilder.Term(field, term, true); |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 44 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 45 | public CollectionBuilder.Interface since (String field, String date) { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 46 | int since = new KrillDate(date).floor(); |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 47 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 48 | if (since == 0 || since == KrillDate.BEGINNING) |
| 49 | return null; |
| 50 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 51 | return new CollectionBuilder.Range(field, since, KrillDate.END); |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 52 | }; |
| 53 | |
| Akron | 5e3436f | 2017-07-04 15:28:03 +0200 | [diff] [blame] | 54 | public CollectionBuilder.Interface nothing () { |
| 55 | |
| 56 | // Requires that a field with name "0---" does not exist |
| 57 | return new CollectionBuilder.Term("0---", "0"); |
| 58 | }; |
| 59 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 60 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 61 | public CollectionBuilder.Interface till (String field, String date) { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 62 | try { |
| 63 | int till = new KrillDate(date).ceil(); |
| 64 | if (till == 0 || till == KrillDate.END) |
| 65 | return null; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 66 | |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 67 | return new CollectionBuilder.Range(field, KrillDate.BEGINNING, |
| 68 | till); |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 69 | } |
| 70 | catch (NumberFormatException e) { |
| 71 | log.warn("Parameter of till(date) is invalid"); |
| 72 | }; |
| 73 | return null; |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 74 | }; |
| 75 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 76 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 77 | // This will be optimized away in future versions |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 78 | public CollectionBuilder.Interface between (String field, String start, |
| 79 | String end) { |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 80 | CollectionBuilder.Interface startObj = this.since(field, start); |
| 81 | if (startObj == null) |
| 82 | return null; |
| 83 | |
| 84 | CollectionBuilder.Interface endObj = this.till(field, end); |
| 85 | if (endObj == null) |
| 86 | return null; |
| 87 | |
| 88 | return this.andGroup().with(startObj).with(endObj); |
| 89 | }; |
| 90 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 91 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 92 | public CollectionBuilder.Interface date (String field, String date) { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 93 | KrillDate dateDF = new KrillDate(date); |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 94 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 95 | if (dateDF.year == 0) |
| 96 | return null; |
| 97 | |
| 98 | if (dateDF.day == 0 || dateDF.month == 0) { |
| 99 | int begin = dateDF.floor(); |
| 100 | int end = dateDF.ceil(); |
| 101 | |
| 102 | if (end == 0 |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 103 | || (begin == KrillDate.BEGINNING && end == KrillDate.END)) |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 104 | return null; |
| 105 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 106 | return new CollectionBuilder.Range(field, begin, end); |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 107 | }; |
| 108 | |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 109 | return new CollectionBuilder.Range(field, dateDF.floor(), |
| 110 | dateDF.ceil()); |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 111 | }; |
| 112 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 113 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 114 | public CollectionBuilder.Group andGroup () { |
| 115 | return new CollectionBuilder.Group(false); |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 116 | }; |
| 117 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 118 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 119 | public CollectionBuilder.Group orGroup () { |
| 120 | return new CollectionBuilder.Group(true); |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 121 | }; |
| 122 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 123 | public interface Interface { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 124 | public String toString (); |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 125 | |
| 126 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 127 | public Filter toFilter (); |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 128 | |
| 129 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 130 | public boolean isNegative (); |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 131 | |
| 132 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 133 | public CollectionBuilder.Interface not (); |
| Nils Diewald | baf68c5 | 2013-11-20 13:22:19 +0000 | [diff] [blame] | 134 | }; |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 135 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 136 | public class Term implements CollectionBuilder.Interface { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 137 | private boolean isNegative = false; |
| 138 | private boolean regex = false; |
| 139 | private String field; |
| 140 | private String term; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 141 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 142 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 143 | public Term (String field, String term) { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 144 | this.field = field; |
| 145 | this.term = term; |
| 146 | }; |
| 147 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 148 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 149 | public Term (String field, String term, boolean regex) { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 150 | this.field = field; |
| 151 | this.term = term; |
| 152 | this.regex = regex; |
| 153 | }; |
| 154 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 155 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 156 | public Filter toFilter () { |
| 157 | // Regular expression |
| 158 | if (this.regex) |
| 159 | return new QueryWrapperFilter( |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 160 | new RegexpQuery(new org.apache.lucene.index.Term( |
| 161 | this.field, this.term))); |
| 162 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 163 | // Simple term |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 164 | return new TermsFilter( |
| 165 | new org.apache.lucene.index.Term(this.field, this.term)); |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 166 | }; |
| 167 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 168 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 169 | public String toString () { |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 170 | Filter filter = this.toFilter(); |
| 171 | if (filter == null) |
| 172 | return ""; |
| 173 | return filter.toString(); |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 174 | }; |
| 175 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 176 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 177 | public boolean isNegative () { |
| 178 | return this.isNegative; |
| 179 | }; |
| 180 | |
| 181 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 182 | public CollectionBuilder.Interface not () { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 183 | this.isNegative = true; |
| 184 | return this; |
| 185 | }; |
| Nils Diewald | baf68c5 | 2013-11-20 13:22:19 +0000 | [diff] [blame] | 186 | }; |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 187 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 188 | public class Group implements CollectionBuilder.Interface { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 189 | private boolean isOptional = false; |
| 190 | private boolean isNegative = true; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 191 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 192 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 193 | public boolean isNegative () { |
| 194 | return this.isNegative; |
| 195 | }; |
| 196 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 197 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 198 | public boolean isOptional () { |
| 199 | return this.isOptional; |
| 200 | }; |
| 201 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 202 | private ArrayList<CollectionBuilder.Interface> operands; |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 203 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 204 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 205 | public Group (boolean optional) { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 206 | this.isOptional = optional; |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 207 | this.operands = new ArrayList<CollectionBuilder.Interface>(3); |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 208 | }; |
| 209 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 210 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 211 | public Group with (CollectionBuilder.Interface cb) { |
| Akron | fd05f50 | 2015-07-30 18:34:26 +0200 | [diff] [blame] | 212 | if (cb == null) |
| 213 | return this; |
| 214 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 215 | if (!cb.isNegative()) |
| 216 | this.isNegative = false; |
| 217 | this.operands.add(cb); |
| 218 | return this; |
| 219 | }; |
| 220 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 221 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 222 | public Group with (String field, String term) { |
| 223 | if (field == null || term == null) |
| 224 | return this; |
| 225 | return this.with(new CollectionBuilder.Term(field, term)); |
| 226 | }; |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 227 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 228 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 229 | public Filter toFilter () { |
| 230 | if (this.operands == null || this.operands.isEmpty()) |
| 231 | return null; |
| 232 | |
| 233 | if (this.operands.size() == 1) |
| 234 | return this.operands.get(0).toFilter(); |
| 235 | |
| 236 | // BooleanFilter bool = new BooleanFilter(); |
| 237 | BooleanGroupFilter bool = new BooleanGroupFilter(this.isOptional); |
| 238 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 239 | Iterator<CollectionBuilder.Interface> i = this.operands.iterator(); |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 240 | while (i.hasNext()) { |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 241 | CollectionBuilder.Interface cb = i.next(); |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 242 | if (cb.isNegative()) { |
| 243 | bool.without(cb.toFilter()); |
| 244 | } |
| 245 | else { |
| 246 | bool.with(cb.toFilter()); |
| 247 | }; |
| 248 | }; |
| 249 | |
| 250 | return bool; |
| 251 | }; |
| 252 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 253 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 254 | public String toString () { |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 255 | Filter filter = this.toFilter(); |
| 256 | if (filter == null) |
| 257 | return ""; |
| 258 | return filter.toString(); |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 259 | }; |
| 260 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 261 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 262 | public CollectionBuilder.Interface not () { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 263 | this.isNegative = true; |
| 264 | return this; |
| 265 | }; |
| Nils Diewald | baf68c5 | 2013-11-20 13:22:19 +0000 | [diff] [blame] | 266 | }; |
| Nils Diewald | fb4d7b0 | 2014-04-09 17:56:17 +0000 | [diff] [blame] | 267 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 268 | public class Range implements CollectionBuilder.Interface { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 269 | private boolean isNegative = false; |
| 270 | private String field; |
| 271 | private int start, end; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 272 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 273 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 274 | public Range (String field, int start, int end) { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 275 | this.field = field; |
| 276 | this.start = start; |
| 277 | this.end = end; |
| 278 | }; |
| Nils Diewald | fb4d7b0 | 2014-04-09 17:56:17 +0000 | [diff] [blame] | 279 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 280 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 281 | public boolean isNegative () { |
| 282 | return this.isNegative; |
| 283 | }; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 284 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 285 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 286 | public String toString () { |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 287 | Filter filter = this.toFilter(); |
| 288 | if (filter == null) |
| 289 | return ""; |
| 290 | return filter.toString(); |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 291 | }; |
| Nils Diewald | 8db8f92 | 2014-10-24 17:43:13 +0000 | [diff] [blame] | 292 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 293 | |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 294 | public Filter toFilter () { |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 295 | return NumericRangeFilter.newIntRange(this.field, this.start, |
| 296 | this.end, true, true); |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 297 | }; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 298 | |
| Akron | 4055017 | 2015-08-04 03:06:12 +0200 | [diff] [blame] | 299 | |
| Akron | 60dfa7e | 2015-08-03 22:15:17 +0200 | [diff] [blame] | 300 | public CollectionBuilder.Interface not () { |
| Akron | 176c9b1 | 2015-07-29 19:53:40 +0200 | [diff] [blame] | 301 | this.isNegative = true; |
| 302 | return this; |
| 303 | }; |
| Nils Diewald | fb4d7b0 | 2014-04-09 17:56:17 +0000 | [diff] [blame] | 304 | }; |
| Nils Diewald | f399a67 | 2013-11-18 17:55:22 +0000 | [diff] [blame] | 305 | }; |