use of org.apache.jackrabbit.oak.query.index.FilterImpl in project jackrabbit-oak by apache.
the class IndexPlannerTest method fullTextQueryNonFulltextIndex.
@Test
public void fullTextQueryNonFulltextIndex() throws Exception {
NodeBuilder defn = newLucenePropertyIndexDefinition(builder, "test", of("foo"), "async");
IndexNode node = createIndexNode(new IndexDefinition(root, defn.getNodeState(), "/foo"));
FilterImpl filter = createFilter("nt:base");
filter.setFullTextConstraint(FullTextParser.parse(".", "mountain"));
IndexPlanner planner = new IndexPlanner(node, "/foo", filter, Collections.<OrderEntry>emptyList());
assertNull(planner.getPlan());
}
use of org.apache.jackrabbit.oak.query.index.FilterImpl in project jackrabbit-oak by apache.
the class IndexPlannerTest method matchingProperty.
@Test
public void matchingProperty() throws Exception {
NodeBuilder defn = newLucenePropertyIndexDefinition(builder, "test", of("foo"), "async");
IndexNode node = createIndexNode(new IndexDefinition(root, defn.getNodeState(), "/foo"));
FilterImpl filter = createFilter("nt:base");
filter.restrictProperty("foo", Operator.EQUAL, PropertyValues.newString("bar"));
IndexPlanner planner = new IndexPlanner(node, "/foo", filter, Collections.<OrderEntry>emptyList());
QueryIndex.IndexPlan plan = planner.getPlan();
assertNotNull(plan);
assertNotNull(pr(plan));
assertTrue(pr(plan).evaluateNonFullTextConstraints());
}
use of org.apache.jackrabbit.oak.query.index.FilterImpl in project jackrabbit-oak by apache.
the class IndexPlannerTest method createPlannerForFulltext.
private IndexPlanner createPlannerForFulltext(NodeState defn, FullTextExpression exp) throws IOException {
IndexNode node = createIndexNode(new IndexDefinition(root, defn, "/foo"));
FilterImpl filter = createFilter("nt:base");
filter.setFullTextConstraint(exp);
return new IndexPlanner(node, "/foo", filter, Collections.<OrderEntry>emptyList());
}
use of org.apache.jackrabbit.oak.query.index.FilterImpl in project jackrabbit-oak by apache.
the class IndexPlannerTest method noMatchingProperty.
@Test
public void noMatchingProperty() throws Exception {
NodeBuilder defn = newLucenePropertyIndexDefinition(builder, "test", of("foo"), "async");
IndexNode node = createIndexNode(new IndexDefinition(root, defn.getNodeState(), "/foo"));
FilterImpl filter = createFilter("nt:base");
filter.restrictProperty("bar", Operator.EQUAL, PropertyValues.newString("bar"));
IndexPlanner planner = new IndexPlanner(node, "/foo", filter, Collections.<OrderEntry>emptyList());
assertNull(planner.getPlan());
}
use of org.apache.jackrabbit.oak.query.index.FilterImpl in project jackrabbit-oak by apache.
the class IndexPlannerTest method purePropertyIndexAndNodeTypeRestriction3.
@Test
public void purePropertyIndexAndNodeTypeRestriction3() throws Exception {
NodeBuilder defn = newLucenePropertyIndexDefinition(builder, "test", of("foo"), "async");
defn.setProperty(LuceneIndexConstants.EVALUATE_PATH_RESTRICTION, true);
defn.setProperty(IndexConstants.DECLARING_NODE_TYPES, of("nt:file"), NAMES);
defn = IndexDefinition.updateDefinition(defn.getNodeState().builder());
NodeBuilder foob = getNode(defn, "indexRules/nt:file/properties/foo");
foob.setProperty(LuceneIndexConstants.PROP_NODE_SCOPE_INDEX, true);
IndexNode node = createIndexNode(new IndexDefinition(root, defn.getNodeState(), "/foo"));
FilterImpl filter = createFilter("nt:file");
IndexPlanner planner = new IndexPlanner(node, "/foo", filter, Collections.<OrderEntry>emptyList());
QueryIndex.IndexPlan plan = planner.getPlan();
assertNotNull(plan);
assertNotNull(pr(plan));
assertTrue(pr(plan).evaluateNodeTypeRestriction());
}
Aggregations