@Test public void requireThatPredicateIndexCanSearchWithNotExpression() { { PredicateIndexBuilder builder = new PredicateIndexBuilder(10); builder.indexDocument(1, Predicate.fromString("country in ['no'] and gender not in ['male']")); PredicateIndex index = builder.build(); PredicateIndex.Searcher searcher = index.searcher(); PredicateQuery query = new PredicateQuery(); query.addFeature("country", "no"); query.addFeature("gender", "female"); assertEquals("[1]", searcher.search(query).collect(toList()).toString()); } { PredicateIndexBuilder builder = new PredicateIndexBuilder(10); builder.indexDocument(DOC_ID, Predicate.fromString("country in ['no'] and gender in ['male']")); builder.indexDocument(DOC_ID + 1, Predicate.fromString("country not in ['no']")); PredicateIndex index = builder.build(); PredicateIndex.Searcher searcher = index.searcher(); PredicateQuery query = new PredicateQuery(); assertEquals("[43]", searcher.search(query).collect(toList()).toString()); query.addFeature("country", "no"); assertEquals(0, searcher.search(query).count()); } { PredicateIndexBuilder builder = new PredicateIndexBuilder(10); builder.indexDocument(DOC_ID, Predicate.fromString("country not in ['no'] and gender not in ['male']")); PredicateIndex index = builder.build(); PredicateIndex.Searcher searcher = index.searcher(); PredicateQuery query = new PredicateQuery(); assertEquals(1, searcher.search(query).count()); query.addFeature("country", "no"); assertEquals(0, searcher.search(query).count()); query.addFeature("gender", "male"); assertEquals(0, searcher.search(query).count()); query = new PredicateQuery(); query.addFeature("gender", "male"); assertEquals(0, searcher.search(query).count()); } }
public Searcher searcher() { return new Searcher(); }
PredicateIndex { public Searcher searcher() { return new Searcher(); } }
PredicateIndex { public Searcher searcher() { return new Searcher(); } PredicateIndex(
            Config config,
            int[] internalToExternalIdMapping,
            byte[] minFeatureIndex,
            short[] intervalEnds,
            int highestIntervalEnd,
            SimpleIndex intervalIndex,
            SimpleIndex boundsIndex,
            SimpleIndex conjunctionIntervalIndex,
            PredicateIntervalStore intervalStore,
            ConjunctionIndex conjunctionIndex,
            int[] zeroConstraintDocuments); }
PredicateIndex { public Searcher searcher() { return new Searcher(); } PredicateIndex(
            Config config,
            int[] internalToExternalIdMapping,
            byte[] minFeatureIndex,
            short[] intervalEnds,
            int highestIntervalEnd,
            SimpleIndex intervalIndex,
            SimpleIndex boundsIndex,
            SimpleIndex conjunctionIntervalIndex,
            PredicateIntervalStore intervalStore,
            ConjunctionIndex conjunctionIndex,
            int[] zeroConstraintDocuments); void rebuildPostingListCache(); Searcher searcher(); void writeToOutputStream(DataOutputStream out); static PredicateIndex fromInputStream(DataInputStream in); }
PredicateIndex { public Searcher searcher() { return new Searcher(); } PredicateIndex(
            Config config,
            int[] internalToExternalIdMapping,
            byte[] minFeatureIndex,
            short[] intervalEnds,
            int highestIntervalEnd,
            SimpleIndex intervalIndex,
            SimpleIndex boundsIndex,
            SimpleIndex conjunctionIntervalIndex,
            PredicateIntervalStore intervalStore,
            ConjunctionIndex conjunctionIndex,
            int[] zeroConstraintDocuments); void rebuildPostingListCache(); Searcher searcher(); void writeToOutputStream(DataOutputStream out); static PredicateIndex fromInputStream(DataInputStream in);  }