RangeQuery.java
846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.zhaoonline.common.es.bean;
import org.elasticsearch.index.query.QueryBuilders;
public class RangeQuery implements QueryInt {
private Object from;
private Object to;
private String rangeKey;
public RangeQuery(String rangeKey,Object from,Object to){
this.rangeKey=rangeKey;
this.from=from;
this.to=to;
}
public Object getFrom() {
return from;
}
public void setFrom(Object from) {
this.from = from;
}
public Object getTo() {
return to;
}
public void setTo(Object to) {
this.to = to;
}
public String getRangeKey() {
return rangeKey;
}
public void setRangeKey(String rangeKey) {
this.rangeKey = rangeKey;
}
@Override
public String getType() {
return "range";
}
@Override
public String toQueryString() {
return QueryBuilders.rangeQuery(rangeKey).from(from).to(to).toString();
}
}