use of com.greplin.lucene.predicate.BitsProvider in project greplin-lucene-utils by Cue.
the class PhraseFilterTest method testIntersectionWithPredicate.
@Test
public void testIntersectionWithPredicate() throws Exception {
IndexReader reader = createReaderWithSampleDocuments();
IntersectionProvider predicate = new BitsProviderIntersectionProvider(new BitsProvider() {
@Override
public Bits get(IndexReader reader) throws IOException {
return new Bits() {
@Override
public boolean get(int index) {
return index != 0;
}
@Override
public int length() {
return 3;
}
};
}
});
assertFilterBitsEqual(reader, new PhraseFilter("f", "world"), true, true, true);
assertFilterBitsEqual(reader, new PhraseFilter(predicate, "f", "world"), false, true, true);
assertFilterBitsEqual(reader, new PhraseFilter("f", "hello", "world"), true, false, true);
assertFilterBitsEqual(reader, new PhraseFilter(predicate, "f", "hello", "world"), false, false, true);
}
Aggregations