FacetBucketUtil { public static boolean isFieldInBucket( Field field, String term, Facet facet) { if (facet instanceof RangeFacet) { String[] range = RangeParserUtil.parserRange(term); String lower = range[0]; String upper = range[1]; String value = field.getValue(); if ((lower.compareTo(value) <= 0) && (value.compareTo(upper) < 0)) { return true; } return false; } if (ArrayUtil.contains(field.getValues(), term, false)) { return true; } return false; }  static boolean isFieldInBucket(
		Field field, String term, Facet facet);  }
@Test public void testFacetImpl() { Field field = new Field(_FIELD_NAME, new String[] {"foo", "bar"}); Facet facet = new FacetImpl(_FIELD_NAME, null); Assert.assertTrue(FacetBucketUtil.isFieldInBucket(field, "foo", facet)); Assert.assertTrue(FacetBucketUtil.isFieldInBucket(field, "bar", facet)); }
@Test public void testMultiValueFacet() { Field field = new Field(_FIELD_NAME, new String[] {"foo", "bar"}); Facet facet = new MultiValueFacet(null); Assert.assertTrue(FacetBucketUtil.isFieldInBucket(field, "bar", facet)); }
@Test public void testRangeFacet() { Field field = new Field(_FIELD_NAME, "007"); Facet facet = new RangeFacet(null); Assert.assertTrue( FacetBucketUtil.isFieldInBucket(field, "[001 TO 999]", facet)); }
@Test public void testSimpleFacet() { Field field = new Field(_FIELD_NAME, "foo"); Facet facet = new SimpleFacet(null); Assert.assertTrue(FacetBucketUtil.isFieldInBucket(field, "foo", facet)); }