lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gol...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/index DocumentWriter.java
Date Fri, 16 Apr 2004 10:15:21 GMT
goller      2004/04/16 03:15:21

  Modified:    src/java/org/apache/lucene/index DocumentWriter.java
  Log:
  iterating over fieldInfos instead of document fields seems
  more natural and more efficient for writeNorms
  
  Revision  Changes    Path
  1.11      +5 -9      jakarta-lucene/src/java/org/apache/lucene/index/DocumentWriter.java
  
  Index: DocumentWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/DocumentWriter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DocumentWriter.java	29 Mar 2004 22:48:02 -0000	1.10
  +++ DocumentWriter.java	16 Apr 2004 10:15:20 -0000	1.11
  @@ -316,15 +316,11 @@
       }
     }
   
  -  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));
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message