mirror of https://github.com/apache/lucene.git
iterating over fieldInfos instead of document fields seems
more natural and more efficient for writeNorms git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150288 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
34b8f647fe
commit
a35399734d
|
@ -316,15 +316,11 @@ final class DocumentWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void writeNorms(Document doc, String segment)
|
private final void writeNorms(Document doc, String segment) throws IOException {
|
||||||
throws IOException {
|
for(int n = 0; n < fieldInfos.size(); n++){
|
||||||
Enumeration fields = doc.fields();
|
FieldInfo fi = fieldInfos.fieldInfo(n);
|
||||||
while (fields.hasMoreElements()) {
|
if(fi.isIndexed){
|
||||||
Field field = (Field) fields.nextElement();
|
float norm = fieldBoosts[n] * similarity.lengthNorm(fi.name, fieldLengths[n]);
|
||||||
if (field.isIndexed()) {
|
|
||||||
int n = fieldInfos.fieldNumber(field.name());
|
|
||||||
float norm =
|
|
||||||
fieldBoosts[n] * similarity.lengthNorm(field.name(), fieldLengths[n]);
|
|
||||||
OutputStream norms = directory.createFile(segment + ".f" + n);
|
OutputStream norms = directory.createFile(segment + ".f" + n);
|
||||||
try {
|
try {
|
||||||
norms.writeByte(similarity.encodeNorm(norm));
|
norms.writeByte(similarity.encodeNorm(norm));
|
||||||
|
|
Loading…
Reference in New Issue