mirror of https://github.com/apache/lucene.git
nocommits
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1441625 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0683a7967b
commit
de223f43f8
|
@ -253,10 +253,7 @@ final class DocFieldProcessor extends DocConsumer {
|
|||
rehash();
|
||||
}
|
||||
} else {
|
||||
// nocommit: dangerous: maybe FI.update()/FI ctor()/FIS.addOrUpdate need only take FT
|
||||
// instead of a thousand parameters? Surely we can make this better... like:
|
||||
// fp.fieldInfo.update(ft);
|
||||
fp.fieldInfo.update(ft.indexed(), false, ft.omitNorms(), false, ft.indexOptions());
|
||||
fp.fieldInfo.update(ft);
|
||||
}
|
||||
|
||||
if (thisFieldGen != fp.lastGen) {
|
||||
|
|
|
@ -20,6 +20,8 @@ package org.apache.lucene.index;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
// nocommit fails if you repeat: TestDocValuesWithThreads.test2 -seed A765AB92D216E371
|
||||
|
||||
/**
|
||||
* Access to the Field Info file that describes document fields and whether or
|
||||
* not they are indexed. Each segment has a separate Field Info file. Objects
|
||||
|
@ -151,6 +153,10 @@ public final class FieldInfo {
|
|||
return true;
|
||||
}
|
||||
|
||||
void update(IndexableFieldType ft) {
|
||||
update(ft.indexed(), false, ft.omitNorms(), false, ft.indexOptions());
|
||||
}
|
||||
|
||||
// should only be called by FieldInfos#addOrUpdate
|
||||
void update(boolean indexed, boolean storeTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions) {
|
||||
//System.out.println("FI.update field=" + name + " indexed=" + indexed + " omitNorms=" + omitNorms + " this.omitNorms=" + this.omitNorms);
|
||||
|
|
|
@ -214,6 +214,7 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
|||
*/
|
||||
// nocommit: why is docvalues involved with global field numbers?
|
||||
// nocommit: and is it even tested...
|
||||
/*
|
||||
synchronized void setIfNotSet(int fieldNumber, String fieldName, DocValuesType dvType) {
|
||||
final Integer boxedFieldNumber = Integer.valueOf(fieldNumber);
|
||||
if (!numberToName.containsKey(boxedFieldNumber)
|
||||
|
@ -227,6 +228,7 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
|||
assert containsConsistent(boxedFieldNumber, fieldName, dvType);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// used by assert
|
||||
synchronized boolean containsConsistent(Integer number, String name, DocValuesType dvType) {
|
||||
|
@ -264,17 +266,6 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* adds the given field to this FieldInfos name / number mapping. The given FI
|
||||
* must be present in the global field number mapping before this method it
|
||||
* called
|
||||
*/
|
||||
private void putInternal(FieldInfo fi) {
|
||||
assert !byName.containsKey(fi.name);
|
||||
assert globalFieldNumbers.containsConsistent(Integer.valueOf(fi.number), fi.name, fi.getDocValuesType());
|
||||
byName.put(fi.name, fi);
|
||||
}
|
||||
|
||||
/** NOTE: this method does not carry over termVector
|
||||
* booleans nor docValuesType; the indexer chain
|
||||
* (TermVectorsConsumerPerField, DocFieldProcessor) must
|
||||
|
@ -296,9 +287,16 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
|||
boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValuesType docValues, DocValuesType normType) {
|
||||
FieldInfo fi = fieldInfo(name);
|
||||
if (fi == null) {
|
||||
// get a global number for this field
|
||||
// This field wasn't yet added to this in-RAM
|
||||
// segment's FieldInfo, so now we get a global
|
||||
// number for this field. If the field was seen
|
||||
// before then we'll get the same name and number,
|
||||
// else we'll allocate a new one:
|
||||
final int fieldNumber = globalFieldNumbers.addOrGet(name, preferredFieldNumber, docValues);
|
||||
fi = addInternal(name, fieldNumber, isIndexed, storeTermVector, omitNorms, storePayloads, indexOptions, docValues, normType);
|
||||
fi = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, omitNorms, storePayloads, indexOptions, docValues, normType, null);
|
||||
assert !byName.containsKey(fi.name);
|
||||
assert globalFieldNumbers.containsConsistent(Integer.valueOf(fi.number), fi.name, fi.getDocValuesType());
|
||||
byName.put(fi.name, fi);
|
||||
} else {
|
||||
fi.update(isIndexed, storeTermVector, omitNorms, storePayloads, indexOptions);
|
||||
|
||||
|
@ -320,15 +318,6 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
|||
fi.getIndexOptions(), fi.getDocValuesType(), fi.getNormType());
|
||||
}
|
||||
|
||||
private FieldInfo addInternal(String name, int fieldNumber, boolean isIndexed,
|
||||
boolean storeTermVector, boolean omitNorms, boolean storePayloads,
|
||||
IndexOptions indexOptions, DocValuesType docValuesType, DocValuesType normType) {
|
||||
globalFieldNumbers.setIfNotSet(fieldNumber, name, docValuesType);
|
||||
final FieldInfo fi = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, omitNorms, storePayloads, indexOptions, docValuesType, normType, null);
|
||||
putInternal(fi);
|
||||
return fi;
|
||||
}
|
||||
|
||||
public FieldInfo fieldInfo(String fieldName) {
|
||||
return byName.get(fieldName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue