@@ -28,6 +28,7 @@ public class TermsFacet extends AbstractFacet {
2828private static final String PARAM_OFFSET ="offset" ;
2929private static final String PARAM_MINCOUNT ="mincount" ;
3030private static final String PARAM_NUM_BUCKETS ="numBuckets" ;
31+ private static final String PARAM_PREFIX ="prefix" ;
3132
3233private final String field ;
3334
@@ -37,6 +38,7 @@ public class TermsFacet extends AbstractFacet {
3738private boolean numBuckets ;
3839
3940private String sort ;
41+ private String prefix ;
4042
4143public TermsFacet (String name ,String field ) {
4244this (name ,field ,null );
@@ -61,6 +63,10 @@ public Integer getOffset() {
6163return this .offset ;
6264 }
6365
66+ public String getPrefix () {
67+ return this .prefix ;
68+ }
69+
6470public void setLimit (Integer limit ) {
6571this .limit =limit ;
6672 }
@@ -77,6 +83,10 @@ public void setOffset(Integer offset) {
7783this .offset =offset ;
7884 }
7985
86+ public void setPrefix (String prefix ) {
87+ this .prefix =prefix ;
88+ }
89+
8090public void setSort (String sort ) {
8191this .sort =sort ;
8292 }
@@ -85,31 +95,36 @@ public void setSort(String sort) {
8595protected void writeFacetConfiguration (JSONWriter jsonWriter ) {
8696super .writeFacetConfiguration (jsonWriter );
8797
88- this . writeStringField (jsonWriter ,PARAM_FIELD ,this .field );
98+ writeStringField (jsonWriter ,PARAM_FIELD ,this .field );
8999
90100if (this .sort !=null ) {
91- this . writeValueSeparator (jsonWriter );
92- this . writeStringField (jsonWriter ,PARAM_SORT ,this .sort );
101+ writeValueSeparator (jsonWriter );
102+ writeStringField (jsonWriter ,PARAM_SORT ,this .sort );
93103 }
94104
95105if (this .offset !=null ) {
96- this . writeValueSeparator (jsonWriter );
97- this . writeNumberField (jsonWriter ,PARAM_OFFSET ,this .offset );
106+ writeValueSeparator (jsonWriter );
107+ writeNumberField (jsonWriter ,PARAM_OFFSET ,this .offset );
98108 }
99109
100110if (this .limit !=null ) {
101- this . writeValueSeparator (jsonWriter );
102- this . writeNumberField (jsonWriter ,PARAM_LIMIT ,this .limit );
111+ writeValueSeparator (jsonWriter );
112+ writeNumberField (jsonWriter ,PARAM_LIMIT ,this .limit );
103113 }
104114
105115if (this .mincount !=null ) {
106- this . writeValueSeparator (jsonWriter );
107- this . writeNumberField (jsonWriter ,PARAM_MINCOUNT ,this .mincount );
116+ writeValueSeparator (jsonWriter );
117+ writeNumberField (jsonWriter ,PARAM_MINCOUNT ,this .mincount );
108118 }
109119
110120if (this .numBuckets ) {
111- this .writeValueSeparator (jsonWriter );
112- this .writeBooleanField (jsonWriter ,PARAM_NUM_BUCKETS ,this .numBuckets );
121+ writeValueSeparator (jsonWriter );
122+ writeBooleanField (jsonWriter ,PARAM_NUM_BUCKETS ,this .numBuckets );
123+ }
124+
125+ if (this .prefix !=null ) {
126+ writeValueSeparator (jsonWriter );
127+ writeStringField (jsonWriter ,PARAM_PREFIX ,this .prefix );
113128 }
114129 }
115130}