Search in sources :

Example 21 with IndexingRule

use of org.apache.jackrabbit.oak.plugins.index.lucene.IndexDefinition.IndexingRule in project jackrabbit-oak by apache.

the class IndexDefinitionTest method propertyDefinitionWithExcludes.

@Test
public void propertyDefinitionWithExcludes() throws Exception {
    builder.child(PROP_NODE).child("foo").setProperty(LuceneIndexConstants.PROP_TYPE, PropertyType.TYPENAME_DATE);
    IndexDefinition idxDefn = new IndexDefinition(root, builder.getNodeState(), "/foo");
    IndexingRule rule = idxDefn.getApplicableIndexingRule(NT_BASE);
    assertTrue(rule.isIndexed("foo"));
    assertTrue(rule.isIndexed("bar"));
    assertEquals(PropertyType.DATE, rule.getConfig("foo").getType());
}
Also used : IndexingRule(org.apache.jackrabbit.oak.plugins.index.lucene.IndexDefinition.IndexingRule) LuceneIndexHelper.newLucenePropertyIndexDefinition(org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneIndexHelper.newLucenePropertyIndexDefinition) LuceneIndexHelper.newLuceneIndexDefinition(org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneIndexHelper.newLuceneIndexDefinition) Test(org.junit.Test)

Example 22 with IndexingRule

use of org.apache.jackrabbit.oak.plugins.index.lucene.IndexDefinition.IndexingRule in project jackrabbit-oak by apache.

the class IndexDefinitionTest method skipTokenization.

@Test
public void skipTokenization() throws Exception {
    NodeBuilder rules = builder.child(INDEX_RULES);
    rules.child("nt:folder");
    TestUtil.child(rules, "nt:folder/properties/prop2").setProperty(LuceneIndexConstants.PROP_NAME, ".*").setProperty(LuceneIndexConstants.PROP_IS_REGEX, true).setProperty(LuceneIndexConstants.PROP_ANALYZED, true);
    IndexDefinition defn = new IndexDefinition(root, builder.getNodeState(), "/foo");
    IndexingRule rule = defn.getApplicableIndexingRule(asState(newNode("nt:folder")));
    assertFalse(rule.getConfig("foo").skipTokenization("foo"));
    assertTrue(rule.getConfig(JcrConstants.JCR_UUID).skipTokenization(JcrConstants.JCR_UUID));
}
Also used : IndexingRule(org.apache.jackrabbit.oak.plugins.index.lucene.IndexDefinition.IndexingRule) LuceneIndexHelper.newLucenePropertyIndexDefinition(org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneIndexHelper.newLucenePropertyIndexDefinition) LuceneIndexHelper.newLuceneIndexDefinition(org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneIndexHelper.newLuceneIndexDefinition) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Test(org.junit.Test)

Aggregations

IndexingRule (org.apache.jackrabbit.oak.plugins.index.lucene.IndexDefinition.IndexingRule)22 LuceneIndexHelper.newLuceneIndexDefinition (org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneIndexHelper.newLuceneIndexDefinition)18 LuceneIndexHelper.newLucenePropertyIndexDefinition (org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneIndexHelper.newLucenePropertyIndexDefinition)18 Test (org.junit.Test)18 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)13 FullTextTerm (org.apache.jackrabbit.oak.query.fulltext.FullTextTerm)2 PropertyRestriction (org.apache.jackrabbit.oak.spi.query.Filter.PropertyRestriction)2 PrefixQuery (org.apache.lucene.search.PrefixQuery)2 TermQuery (org.apache.lucene.search.TermQuery)2 WildcardQuery (org.apache.lucene.search.WildcardQuery)2 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 TermFactory.newFulltextTerm (org.apache.jackrabbit.oak.plugins.index.lucene.TermFactory.newFulltextTerm)1 TermFactory.newPathTerm (org.apache.jackrabbit.oak.plugins.index.lucene.TermFactory.newPathTerm)1 FullTextContains (org.apache.jackrabbit.oak.query.fulltext.FullTextContains)1 FullTextExpression (org.apache.jackrabbit.oak.query.fulltext.FullTextExpression)1 FullTextVisitor (org.apache.jackrabbit.oak.query.fulltext.FullTextVisitor)1 IndexPlan (org.apache.jackrabbit.oak.spi.query.QueryIndex.IndexPlan)1 OrderEntry (org.apache.jackrabbit.oak.spi.query.QueryIndex.OrderEntry)1