Skip to content

Apache Lucene open-source search software

MERGE - catching up with trunk

Simon Willnauered39d96af4ad
diff --cc lucene/src/java/org/apache/lucene/index/DocFieldProcessorPerThread.java
index 5bd7321fce1,8e922364eab..9594591015b
--- a/lucene/src/java/org/apache/lucene/index/DocFieldProcessorPerThread.java
+++ b/lucene/src/java/org/apache/lucene/index/DocFieldProcessorPerThread.java
@@@ -246,24 -243,11 +247,24 @@@ final class DocFieldProcessorPerThread
// sort the subset of fields that have vectors
// enabled; we could save [small amount of] CPU
// here.
- quickSort(fields, 0, fieldCount-1);
+ ArrayUtil.quickSort(fields, 0, fieldCount, fieldsComp);
-
- for(int i=0;i<fieldCount;i++)
- fields[i].consumer.processFields(fields[i].fields, fields[i].fieldCount);
-
+
+
+ for(int i=0;i<fieldCount;i++) {
+ final DocFieldProcessorPerField perField = fields[i];
+ final Fieldable fieldable = perField.fields[0];
+ perField.consumer.processFields(perField.fields, perField.fieldCount);
+
+ if(!fieldable.hasFieldAttribute())
+ continue;
+ final AttributeSource attrSource = fieldable.getFieldAttributes();
+ if(!attrSource.hasAttribute(ValuesAttribute.class))
+ continue;
+ final ValuesAttribute attribute = attrSource.getAttribute(ValuesAttribute.class);
+ final DocValuesConsumer consumer = docFieldProcessor.docValuesConsumer(docState.docWriter.directory,
+ docState.docWriter.segment, fieldable.name(), attribute, perField.fieldInfo);
+ consumer.add(docState.docID, attribute);
+ }
if (docState.maxTermPrefix != null && docState.infoStream != null) {
docState.infoStream.println("WARNING: document contains at least one immense term (whose UTF8 encoding is longer than the max length " + DocumentsWriter.MAX_TERM_LENGTH_UTF8 + "), all of which were skipped. Please correct the analyzer to not produce such terms. The prefix of the first immense term is: '" + docState.maxTermPrefix + "...'");
docState.maxTermPrefix = null;
diff --cc lucene/src/java/org/apache/lucene/index/IndexReader.java
index c292460d2f5,14498527844..060346373ff
--- a/lucene/src/java/org/apache/lucene/index/IndexReader.java
+++ b/lucene/src/java/org/apache/lucene/index/IndexReader.java
@@@ -21,8 -21,8 +21,9 @@@ import org.apache.lucene.document.Docum
import org.apache.lucene.document.FieldSelector;
import org.apache.lucene.search.Similarity;
import org.apache.lucene.index.codecs.CodecProvider;
+import org.apache.lucene.index.values.DocValues;
import org.apache.lucene.store.*;
+ import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.ReaderUtil; // for javadocs