lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carl...@apache.org
Subject cvs commit: jakarta-lucene-sandbox/contributions/searchbean/src/java/org/apache/lucene/beans SortedField.java
Date Sat, 07 Sep 2002 01:00:57 GMT
carlson     2002/09/06 18:00:57

  Modified:    contributions/searchbean/src/java/org/apache/lucene/beans
                        SortedField.java
  Log:
  I have modified the SortedField to not access deleted documents. This caused an exception
when filling the initial arrays.

  
  Revision  Changes    Path
  1.2       +7 -3      jakarta-lucene-sandbox/contributions/searchbean/src/java/org/apache/lucene/beans/SortedField.java
  
  Index: SortedField.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene-sandbox/contributions/searchbean/src/java/org/apache/lucene/beans/SortedField.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SortedField.java	23 May 2002 00:45:09 -0000	1.1
  +++ SortedField.java	7 Sep 2002 01:00:57 -0000	1.2
  @@ -10,7 +10,7 @@
   import org.apache.lucene.index.IndexReader;
   import org.apache.lucene.store.Directory;
   
  -import java.util.Hashtable; 
  +import java.util.Hashtable;
   
   import java.io.File;
   import java.io.IOException;
  @@ -54,7 +54,7 @@
        * @param fieldName the name of the field to add
        * @param directory Lucene Directory
        */
  -    public static void addField(String fieldName, Directory directory) throws IOException{
       
  +    public static void addField(String fieldName, Directory directory) throws IOException{
           IndexReader ir = IndexReader.open(directory);
           addField(fieldName, ir);
       }
  @@ -73,7 +73,11 @@
           int numDocs = ir.numDocs();
           fieldValues = new String[numDocs];
           for (int i=0; i<numDocs; i++) {
  -            fieldValues[i] = ir.document(i).get(fieldName);
  +            if (ir.isDeleted(i) == false){
  +                fieldValues[i] = ir.document(i).get(fieldName);
  +            } else {
  +                fieldValues[i] = "";
  +            }
           }
           ir.close();
       }
  
  
  

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


Mime
View raw message