jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r330270 - in /incubator/jackrabbit/trunk/src: conf/ java/org/apache/jackrabbit/core/query/lucene/
Date Wed, 02 Nov 2005 15:17:56 GMT
Author: mreutegg
Date: Wed Nov  2 07:17:47 2005
New Revision: 330270

URL: http://svn.apache.org/viewcvs?rev=330270&view=rev
Log:
JCR-220: Make it possible to configure Lucene Analyzer for SearchIndex
missing getAnalyzer() method

Modified:
    incubator/jackrabbit/trunk/src/conf/repository.xml
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java

Modified: incubator/jackrabbit/trunk/src/conf/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/conf/repository.xml?rev=330270&r1=330269&r2=330270&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/conf/repository.xml (original)
+++ incubator/jackrabbit/trunk/src/conf/repository.xml Wed Nov  2 07:17:47 2005
@@ -200,6 +200,7 @@
               detects a prior forced shutdown.
             - autoRepair: errors detected by a consistency check are automatically
               repaired. If false, errors are only written to the log.
+            - analyzer: class name of a lucene analyzer to use for fulltext indexing of text.
 
             Note: all parameters (except path) in this SearchIndex config are default
             values and can be omitted.
@@ -215,6 +216,7 @@
             <param name="cacheSize" value="1000"/>
             <param name="forceConsistencyCheck" value="false"/>
             <param name="autoRepair" value="true"/>
+            <param name="analyzer" value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
         </SearchIndex>
     </Workspace>
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java?rev=330270&r1=330269&r2=330270&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
Wed Nov  2 07:17:47 2005
@@ -234,7 +234,7 @@
                     continue;
                 }
                 PersistentIndex index = new PersistentIndex(indexNames.getName(i),
-                        sub, false, handler.getAnalyzer(), cache);
+                        sub, false, handler.getTextAnalyzer(), cache);
                 index.setMaxMergeDocs(handler.getMaxMergeDocs());
                 index.setMergeFactor(handler.getMergeFactor());
                 index.setMinMergeDocs(handler.getMinMergeDocs());
@@ -460,7 +460,7 @@
             sub = new File(indexDir, indexName);
         }
         PersistentIndex index = new PersistentIndex(indexName, sub, create,
-                handler.getAnalyzer(), cache);
+                handler.getTextAnalyzer(), cache);
         index.setMaxMergeDocs(handler.getMaxMergeDocs());
         index.setMergeFactor(handler.getMergeFactor());
         index.setMinMergeDocs(handler.getMinMergeDocs());
@@ -700,7 +700,7 @@
      * Resets the volatile index to a new instance.
      */
     private void resetVolatileIndex() throws IOException {
-        volatileIndex = new VolatileIndex(handler.getAnalyzer());
+        volatileIndex = new VolatileIndex(handler.getTextAnalyzer());
         volatileIndex.setUseCompoundFile(handler.getUseCompoundFile());
         volatileIndex.setBufferSize(handler.getBufferSize());
     }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java?rev=330270&r1=330269&r2=330270&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java
Wed Nov  2 07:17:47 2005
@@ -146,7 +146,7 @@
         // build lucene query
         Query query = LuceneQueryBuilder.createQuery(root, session,
                 index.getContext().getItemStateManager(), index.getNamespaceMappings(),
-                index.getAnalyzer(), propReg);
+                index.getTextAnalyzer(), propReg);
 
         OrderQueryNode orderNode = root.getOrderNode();
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?rev=330270&r1=330269&r2=330270&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
Wed Nov  2 07:17:47 2005
@@ -328,17 +328,43 @@
      * Returns the analyzer in use for indexing.
      * @return the analyzer in use for indexing.
      */
-    Analyzer getAnalyzer() {
+    Analyzer getTextAnalyzer() {
         return analyzer;
     }
 
     /**
+     * Returns the namespace mappings for the internal representation.
+     * @return the namespace mappings for the internal representation.
+     */
+    NamespaceMappings getNamespaceMappings() {
+        return index.getNamespaceMappings();
+    }
+
+    /**
+     * Creates a lucene <code>Document</code> from a node state using the
+     * namespace mappings <code>nsMappings</code>.
+     * @param node the node state to index.
+     * @param nsMappings the namespace mappings of the search index.
+     * @return a lucene <code>Document</code> that contains all properties
+     *  of <code>node</code>.
+     * @throws RepositoryException if an error occurs while indexing the
+     *  <code>node</code>.
+     */
+    protected Document createDocument(NodeState node, NamespaceMappings nsMappings)
+            throws RepositoryException {
+        return NodeIndexer.createDocument(node, getContext().getItemStateManager(),
+                nsMappings);
+    }
+
+    //--------------------------< properties >----------------------------------
+
+    /**
      * Sets the analyzer in use for indexing. The given analyzer class name
      * must satisfy the following conditions:
      * <ul>
      *   <li>the class must exist in the class path</li>
      *   <li>the class must have a public default constructor</li>
-     *   <li>the class must be a Lucene Analyzer</li> 
+     *   <li>the class must be a Lucene Analyzer</li>
      * </ul>
      * <p>
      * If the above conditions are met, then a new instance of the class is
@@ -347,7 +373,7 @@
      * <p>
      * This property setter method is normally invoked by the Jackrabbit
      * configuration mechanism if the "analyzer" parameter is set in the
-     * search configuration. 
+     * search configuration.
      *
      * @param analyzerClassName the analyzer class name
      */
@@ -361,30 +387,13 @@
     }
 
     /**
-     * Returns the namespace mappings for the internal representation.
-     * @return the namespace mappings for the internal representation.
-     */
-    NamespaceMappings getNamespaceMappings() {
-        return index.getNamespaceMappings();
-    }
-
-    /**
-     * Creates a lucene <code>Document</code> from a node state using the
-     * namespace mappings <code>nsMappings</code>.
-     * @param node the node state to index.
-     * @param nsMappings the namespace mappings of the search index.
-     * @return a lucene <code>Document</code> that contains all properties
-     *  of <code>node</code>.
-     * @throws RepositoryException if an error occurs while indexing the
-     *  <code>node</code>.
+     * Returns the class name of the analyzer that is currently in use.
+     *
+     * @return class name of analyzer in use.
      */
-    protected Document createDocument(NodeState node, NamespaceMappings nsMappings)
-            throws RepositoryException {
-        return NodeIndexer.createDocument(node, getContext().getItemStateManager(),
-                nsMappings);
+    public String getAnalyzer() {
+        return analyzer.getClass().getName();
     }
-
-    //--------------------------< properties >----------------------------------
 
     /**
      * Sets the location of the search index.



Mime
View raw message