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)
|
||||
throws IOException {
|
||||
Enumeration fields = doc.fields();
|
||||
while (fields.hasMoreElements()) {
|
||||
Field field = (Field) fields.nextElement();
|
||||
if (field.isIndexed()) {
|
||||
int n = fieldInfos.fieldNumber(field.name());
|
||||
float norm =
|
||||
fieldBoosts[n] * similarity.lengthNorm(field.name(), fieldLengths[n]);
|
||||
private final void writeNorms(Document doc, String segment) throws IOException {
|
||||
for(int n = 0; n < fieldInfos.size(); n++){
|
||||
FieldInfo fi = fieldInfos.fieldInfo(n);
|
||||
if(fi.isIndexed){
|
||||
float norm = fieldBoosts[n] * similarity.lengthNorm(fi.name, fieldLengths[n]);
|
||||
OutputStream norms = directory.createFile(segment + ".f" + n);
|
||||
try {
|
||||
norms.writeByte(similarity.encodeNorm(norm));
|
||||
|
|
Loading…
Reference in New Issue