jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1325820 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene: LazyTextExtractorField.java NodeIndexer.java
Date Fri, 13 Apr 2012 15:58:20 GMT
Author: alexparvulescu
Date: Fri Apr 13 15:58:20 2012
New Revision: 1325820

URL: http://svn.apache.org/viewvc?rev=1325820&view=rev
Log:
JCR-3282 Optimize usage of norms

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java?rev=1325820&r1=1325819&r2=1325820&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LazyTextExtractorField.java
Fri Apr 13 15:58:20 2012
@@ -66,20 +66,24 @@ public class LazyTextExtractorField exte
     private volatile String extract = null;
 
     /**
-     * Creates a new <code>LazyTextExtractorField</code> with the given
-     * <code>name</code>.
-     *
-     * @param name the name of the field.
-     * @param reader the reader where to obtain the string from.
-     * @param highlighting set to <code>true</code> to
-     *                     enable result highlighting support
+     * Creates a new <code>LazyTextExtractorField</code>.
+     * 
+     * @param parser
+     * @param value
+     * @param metadata
+     * @param executor
+     * @param highlighting
+     *            set to <code>true</code> to enable result highlighting support
+     * @param maxFieldLength
+     * @param withNorms
      */
     public LazyTextExtractorField(
             Parser parser, InternalValue value, Metadata metadata,
-            Executor executor, boolean highlighting, int maxFieldLength) {
+            Executor executor, boolean highlighting, int maxFieldLength,
+            boolean withNorms) {
         super(FieldNames.FULLTEXT,
                 highlighting ? Store.YES : Store.NO,
-                Field.Index.ANALYZED,
+                withNorms ? Field.Index.ANALYZED : Field.Index.ANALYZED_NO_NORMS,
                 highlighting ? TermVector.WITH_OFFSETS : TermVector.NO);
         executor.execute(
                 new ParsingTask(parser, value, metadata, maxFieldLength));

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java?rev=1325820&r1=1325819&r2=1325820&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
Fri Apr 13 15:58:20 2012
@@ -449,7 +449,7 @@ public class NodeIndexer {
                             Metadata.CONTENT_ENCODING, encoding.getString());
                 }
 
-                doc.add(createFulltextField(internalValue, metadata));
+                doc.add(createFulltextField(internalValue, metadata, false));
             }
         } catch (Throwable t) {
             // TODO: How to recover from a transient indexing failure?
@@ -844,12 +844,25 @@ public class NodeIndexer {
      * @param value the binary value
      * @param metadata document metatadata
      * @return a lucene field.
+     * @deprecated use {@link #createFulltextField(InternalValue, Metadata, boolean)} instead.
      */
     protected Fieldable createFulltextField(
             InternalValue value, Metadata metadata) {
-        return new LazyTextExtractorField(
-                parser, value, metadata, executor,
-                supportHighlighting, getMaxExtractLength());
+        return createFulltextField(value, metadata, true);
+    }
+
+    /**
+     * Creates a fulltext field for the reader <code>value</code>.
+     *
+     * @param value the binary value
+     * @param metadata document metatadata
+     * @param withNorms if norm information should be added for this value
+     * @return a lucene field.
+     */
+    protected Fieldable createFulltextField(
+            InternalValue value, Metadata metadata, boolean withNorms) {
+        return new LazyTextExtractorField(parser, value, metadata, executor,
+                supportHighlighting, getMaxExtractLength(), withNorms);
     }
 
     /**



Mime
View raw message