You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ch...@apache.org on 2014/12/11 16:27:03 UTC
svn commit: r1644677 -
/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java
Author: chetanm
Date: Thu Dec 11 15:27:03 2014
New Revision: 1644677
URL: http://svn.apache.org/r1644677
Log:
OAK-2301 QueryEngine should not tokenize fulltext expression by default
Adding related testcase based on LucenePropertyIndex
Modified:
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java
Modified: jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java?rev=1644677&r1=1644676&r2=1644677&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java (original)
+++ jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java Thu Dec 11 15:27:03 2014
@@ -92,23 +92,32 @@ public class LucenePropertyIndexTest ext
.with(new NodeTypeIndexProvider())
.createContentRepository();
}
-
- // TODO OAK-2301
-// @Test
-// public void fulltextSearchWithCustomAnalyzer() throws Exception{
-// Tree idx = createFulltextIndex(root.getTree("/"), "test");
-// TestUtil.useV2(idx);
-//
-// Tree anl = idx.addChild(ANALYZERS).addChild(ANL_DEFAULT);
-// anl.addChild(ANL_TOKENIZER).setProperty(ANL_NAME, "whitespace");
-// anl.addChild(ANL_FILTERS).addChild("stop");
-//
-// Tree test = root.getTree("/").addChild("test");
-// test.setProperty("foo", "fox jumping");
-// root.commit();
-//
-// assertQuery("select * from [nt:base] where CONTAINS(*, 'fox was jumping')", asList("/test"));
-// }
+
+ @Test
+ public void fulltextSearchWithCustomAnalyzer() throws Exception {
+ Tree idx = createFulltextIndex(root.getTree("/"), "test");
+ TestUtil.useV2(idx);
+
+ Tree anl = idx.addChild(LuceneIndexConstants.ANALYZERS).addChild(LuceneIndexConstants.ANL_DEFAULT);
+ anl.addChild(LuceneIndexConstants.ANL_TOKENIZER).setProperty(LuceneIndexConstants.ANL_NAME, "whitespace");
+ anl.addChild(LuceneIndexConstants.ANL_FILTERS).addChild("stop");
+
+ Tree test = root.getTree("/").addChild("test");
+ test.setProperty("foo", "fox jumping");
+ root.commit();
+
+ assertQuery("select * from [nt:base] where CONTAINS(*, 'fox was jumping')", asList("/test"));
+ }
+
+ private Tree createFulltextIndex(Tree index, String name) throws CommitFailedException {
+ Tree def = index.addChild(INDEX_DEFINITIONS_NAME).addChild(name);
+ def.setProperty(JcrConstants.JCR_PRIMARYTYPE,
+ INDEX_DEFINITIONS_NODE_TYPE, Type.NAME);
+ def.setProperty(TYPE_PROPERTY_NAME, LuceneIndexConstants.TYPE_LUCENE);
+ def.setProperty(REINDEX_PROPERTY_NAME, true);
+ def.setProperty(createProperty(LuceneIndexConstants.INCLUDE_PROPERTY_TYPES, of(PropertyType.TYPENAME_STRING), STRINGS));
+ return index.getChild(INDEX_DEFINITIONS_NAME).getChild(name);
+ }
@Test
public void indexSelection() throws Exception {