jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1412814 - in /jackrabbit/oak/trunk/oak-lucene/src: main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ test/java/org/apache/jackrabbit/oak/plugins/index/lucene/
Date Fri, 23 Nov 2012 10:41:33 GMT
Author: alexparvulescu
Date: Fri Nov 23 10:41:32 2012
New Revision: 1412814

URL: http://svn.apache.org/viewvc?rev=1412814&view=rev
Log:
OAK-154 Full text search index
 - improved tests

Added:
    jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LowCostLuceneIndexProvider.java
  (with props)
Modified:
    jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexProvider.java
    jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java

Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexProvider.java?rev=1412814&r1=1412813&r2=1412814&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexProvider.java
Fri Nov 23 10:41:32 2012
@@ -52,8 +52,12 @@ public class LuceneIndexProvider impleme
         for (IndexDefinition child : buildIndexDefinitions(nodeState, "/",
                 TYPE_LUCENE)) {
             LOG.debug("found a lucene index definition {}", child);
-            tempIndexes.add(new LuceneIndex(child));
+            tempIndexes.add(newLuceneIndex(child));
         }
         return tempIndexes;
     }
+
+    protected LuceneIndex newLuceneIndex(IndexDefinition child) {
+        return new LuceneIndex(child);
+    }
 }

Added: jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LowCostLuceneIndexProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LowCostLuceneIndexProvider.java?rev=1412814&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LowCostLuceneIndexProvider.java
(added)
+++ jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LowCostLuceneIndexProvider.java
Fri Nov 23 10:41:32 2012
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.index.lucene;
+
+import org.apache.jackrabbit.oak.plugins.index.IndexDefinition;
+import org.apache.jackrabbit.oak.spi.query.Filter;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+
+/**
+ * A LuceneIndexProvider that return a LuceneIndex with a really low cost, so
+ * that it tries to guarantee its usage in the queries
+ * 
+ */
+public class LowCostLuceneIndexProvider extends LuceneIndexProvider {
+
+    @Override
+    protected LuceneIndex newLuceneIndex(IndexDefinition child) {
+        return new LowCostLuceneIndex(child);
+    }
+
+    private static class LowCostLuceneIndex extends LuceneIndex {
+
+        public LowCostLuceneIndex(IndexDefinition indexDefinition) {
+            super(indexDefinition);
+        }
+
+        @Override
+        public double getCost(Filter filter, NodeState root) {
+            return 1e-3;
+        }
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LowCostLuceneIndexProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java?rev=1412814&r1=1412813&r2=1412814&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
Fri Nov 23 10:41:32 2012
@@ -46,9 +46,8 @@ public class LuceneIndexQueryTest extend
 
     @Override
     protected ContentRepository createRepository() {
-        return new Oak()
-            .with(new InitialContent())
-            .with(new LuceneIndexProvider())
+        return new Oak().with(new InitialContent())
+            .with(new LowCostLuceneIndexProvider())
             .with(new LuceneIndexHookProvider())
             .createContentRepository();
     }



Mime
View raw message