jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1592468 - in /jackrabbit/oak/trunk/oak-solr-core/src: main/resources/solr/oak/conf/schema.xml test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/DefaultAnalyzersConfigurationTest.java test/resources/solr/oak/conf/schema.xml
Date Mon, 05 May 2014 08:43:39 GMT
Author: tommaso
Date: Mon May  5 08:43:39 2014
New Revision: 1592468

URL: http://svn.apache.org/r1592468
Log:
OAK-1792 - fixed descendent_path type definition

Modified:
    jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/oak/conf/schema.xml
    jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/DefaultAnalyzersConfigurationTest.java
    jackrabbit/oak/trunk/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml

Modified: jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/oak/conf/schema.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/oak/conf/schema.xml?rev=1592468&r1=1592467&r2=1592468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/oak/conf/schema.xml (original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/main/resources/solr/oak/conf/schema.xml Mon May
 5 08:43:39 2014
@@ -21,6 +21,8 @@
     <fieldType name="descendent_path" class="solr.TextField">
       <analyzer type="index">
         <tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
+        <filter class="solr.PatternCaptureGroupFilterFactory" pattern="((/).*)" preserve_original="false"/>
+        <filter class="solr.RemoveDuplicatesTokenFilterFactory" />
       </analyzer>
       <analyzer type="query">
         <tokenizer class="solr.KeywordTokenizerFactory" />

Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/DefaultAnalyzersConfigurationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/DefaultAnalyzersConfigurationTest.java?rev=1592468&r1=1592467&r2=1592468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/DefaultAnalyzersConfigurationTest.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/configuration/DefaultAnalyzersConfigurationTest.java
Mon May  5 08:43:39 2014
@@ -25,7 +25,9 @@ import org.apache.lucene.analysis.TokenS
 import org.apache.lucene.analysis.Tokenizer;
 import org.apache.lucene.analysis.core.KeywordTokenizer;
 import org.apache.lucene.analysis.miscellaneous.LengthFilter;
+import org.apache.lucene.analysis.miscellaneous.RemoveDuplicatesTokenFilter;
 import org.apache.lucene.analysis.path.PathHierarchyTokenizer;
+import org.apache.lucene.analysis.pattern.PatternCaptureGroupTokenFilter;
 import org.apache.lucene.analysis.pattern.PatternReplaceFilter;
 import org.apache.lucene.analysis.reverse.ReverseStringFilter;
 import org.apache.lucene.util.LuceneTestCase;
@@ -101,7 +103,9 @@ public class DefaultAnalyzersConfigurati
             @Override
             protected TokenStreamComponents createComponents(String fieldName, Reader reader)
{
                 Tokenizer source = new PathHierarchyTokenizer(reader);
-                return new TokenStreamComponents(source);
+                TokenStream filter = new PatternCaptureGroupTokenFilter(source, false, Pattern.compile("((\\/).*)"));
+                filter = new RemoveDuplicatesTokenFilter(filter);
+                return new TokenStreamComponents(source, filter);
             }
         };
         this.allChildrenPathSearchingAnalyzer = new Analyzer() {
@@ -117,7 +121,7 @@ public class DefaultAnalyzersConfigurati
     public void testAllChildrenIndexingTokenization() throws Exception {
         try {
             TokenStream ts = allChildrenPathIndexingAnalyzer.tokenStream("text", new StringReader("/jcr:a/jcr:b/c/jcr:d"));
-            assertTokenStreamContents(ts, new String[]{"/jcr:a", "/jcr:a/jcr:b", "/jcr:a/jcr:b/c",
"/jcr:a/jcr:b/c/jcr:d"});
+            assertTokenStreamContents(ts, new String[]{"/jcr:a", "/", "/jcr:a/jcr:b", "/jcr:a/jcr:b/c",
"/jcr:a/jcr:b/c/jcr:d"});
         } finally {
             allChildrenPathIndexingAnalyzer.close();
         }
@@ -191,13 +195,21 @@ public class DefaultAnalyzersConfigurati
     public void testAllChildrenPathMatching() throws Exception {
         String nodePath = "/jcr:a/jcr:b/c";
         String descendantPath = nodePath + "/d/jcr:e";
-        assertAnalyzesTo(allChildrenPathIndexingAnalyzer, descendantPath, new String[]{"/jcr:a",
"/jcr:a/jcr:b", "/jcr:a/jcr:b/c", "/jcr:a/jcr:b/c/d", "/jcr:a/jcr:b/c/d/jcr:e"});
+        assertAnalyzesTo(allChildrenPathIndexingAnalyzer, descendantPath, new String[]{"/jcr:a",
"/", "/jcr:a/jcr:b", "/jcr:a/jcr:b/c", "/jcr:a/jcr:b/c/d", "/jcr:a/jcr:b/c/d/jcr:e"});
         assertAnalyzesTo(allChildrenPathSearchingAnalyzer, nodePath, new String[]{nodePath});
         assertAnalyzesTo(allChildrenPathSearchingAnalyzer, "/jcr:a", new String[]{"/jcr:a"});
         assertAnalyzesTo(allChildrenPathSearchingAnalyzer, "/jcr:a/b", new String[]{"/jcr:a/b"});
         assertAnalyzesTo(allChildrenPathSearchingAnalyzer, "/a/b/c", new String[]{"/a/b/c"});
         assertAnalyzesTo(allChildrenPathSearchingAnalyzer, "/a/b/c/d", new String[]{"/a/b/c/d"});
         assertAnalyzesTo(allChildrenPathSearchingAnalyzer, "/a/b/c/d/jcr:e", new String[]{"/a/b/c/d/jcr:e"});
+        assertAnalyzesTo(allChildrenPathSearchingAnalyzer, "/", new String[]{"/"});
+    }
+
+    @Test
+    public void testAllChildrenPathMatchingOnRootNode() throws Exception {
+        String nodePath = "/";
+        String descendantPath = nodePath + "jcr:a/jcr:b";
+        assertAnalyzesTo(allChildrenPathIndexingAnalyzer, descendantPath, new String[]{"/jcr:a",
"/", "/jcr:a/jcr:b"});
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml?rev=1592468&r1=1592467&r2=1592468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml (original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/resources/solr/oak/conf/schema.xml Mon May
 5 08:43:39 2014
@@ -21,6 +21,8 @@
         <fieldType name="descendent_path" class="solr.TextField">
             <analyzer type="index">
                 <tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
+                <filter class="solr.PatternCaptureGroupFilterFactory" pattern="((/).*)"
preserve_original="false"/>
+                <filter class="solr.RemoveDuplicatesTokenFilterFactory" />
             </analyzer>
             <analyzer type="query">
                 <tokenizer class="solr.KeywordTokenizerFactory" />



Mime
View raw message