Changeset 9975


Ignore:
Timestamp:
2005-05-26T16:18:44+12:00 (19 years ago)
Author:
kjdon
Message:

tidied up the MGIndexer. no longer based on AbstractIndexer - I'm going to get rid of that eventually

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers/MGIndexer.java

    r9940 r9975  
    2222import org.greenstone.gsdl3.gs3build.metadata.*;
    2323import org.greenstone.gsdl3.gs3build.xpointer.XPointer;
     24import org.greenstone.gsdl3.gs3build.util.DOMUtils;
    2425import org.greenstone.gsdl3.util.GSXML;
    2526import org.greenstone.gsdl3.util.Misc;
    2627import org.greenstone.gsdl3.util.Processing;
    2728
    28 public class MGIndexer extends AbstractIndexer
     29// for debug
     30import org.greenstone.gsdl3.util.XMLConverter;
     31
     32public class MGIndexer //extends AbstractIndexer
     33    implements IndexerInterface
    2934{
    3035    int          pass;
     
    3338    boolean      firstDocument;
    3439    String       outputDirectory;
    35     //   InputStream  indexerFeedback;
    36     //   InputStream  indexerErrors;
    37     //OutputStream indexerTextfeed;
    3840    StringBuffer indexBuffer;
    39     //Process      mg_passes;
    4041    File         textDirectory;
    4142    File         indexDirectory;
     
    4546    String       overallName;
    4647   
    47     String       currentIndexName;
    48     String       currentIndexLevel;
    49     String       currentIndexField;
    50 
     48    MGIndex current_index = null;
    5149    MGPassesWrapper mgPasses;
    5250   
    5351    static final char END_OF_DOCUMENT = (char) 2;
    54     static final char END_OF_SECTION  = (char) 3; // actually this is end of para for mg
     52    //static final char END_OF_SECTION  = (char) 3; // actually this is end of para for mg - don't use this yet
    5553    static final char END_OF_STREAM   = (char) 4;
    5654
     
    6260    String name=null;
    6361    String level=null;
    64     String field=null;
     62    List fields=null;
    6563    boolean error = false;// assume built until we get an error
    66 
    67     public MGIndex(String name, String level, String field)
     64   
     65    public MGIndex(Element index_element) {
     66       
     67        this.fields = new ArrayList();
     68        this.name = index_element.getAttribute(GSXML.NAME_ATT);
     69        if (this.name.equals("")) {
     70        // TODO make this dynamic
     71        this.name = "xx";
     72        }
     73        NodeList children = index_element.getChildNodes();
     74        for (int c = 0; c < children.getLength(); c ++) {
     75        Node child = children.item(c);
     76       
     77        if (child.getNodeType() == Node.ELEMENT_NODE) {
     78            String name = child.getNodeName();
     79     
     80            if (name.equals(GSXML.LEVEL_ELEM)) {
     81            this.level = DOMUtils.getNodeChildText(children.item(c));
     82            }
     83            else if (name.equals(GSXML.FIELD_ELEM)) {
     84            String fieldName = DOMUtils.getNodeChildText(children.item(c));
     85            this.fields.add(fieldName);
     86            }
     87        }
     88        }
     89    }
     90
     91    public MGIndex(String name, String level, List fields)
    6892    {
    6993        this.name  = name;
    7094        this.level = level;
    71         this.field = field;
    72     }
    73    
     95        this.fields = fields;
     96    }
     97   
     98    // old gs2 style config - can we get rid of this??
    7499    public MGIndex(String indexLabel)
    75100    {
    76101        int colonAt = indexLabel.indexOf(':');
    77102       
    78         if (colonAt >= 0) {
    79         this.field = indexLabel.substring(colonAt+1);
    80         this.level = indexLabel.substring(0, colonAt);
    81         createIndexName();
    82         }
    83     }
    84 
    85     public String getLevel()
    86     {
    87         return this.level;
    88     }
    89 
    90     public String getField()
    91     {
    92         return this.field;
    93     }
    94 
    95     public String getName()
    96     {
    97         if (this.name==null || this.name.equals("")) {
    98         createIndexName();
    99         }
    100         return this.name;
    101     }
    102 
    103     public boolean hasError() {
    104         return this.error;
    105     }
    106     public void setError(boolean b) {
    107         this.error = b;
    108     }
    109 
    110     private void createIndexName() {
     103        if (colonAt < 0) {
     104        System.err.println("MGIndex(): invalid index specification: "+indexLabel);
     105        return;
     106        }
     107        String field_string = indexLabel.substring(colonAt+1);
     108        String [] field_list = field_string.split(",");
     109        this.fields = new ArrayList();
     110        for (int i=0; i<field_list.length; i++) {
     111        this.fields.add(field_list[i]);
     112        }
     113        this.level = indexLabel.substring(0, colonAt);
     114        //createIndexName
    111115        StringBuffer new_name = new StringBuffer();
    112116        new_name.append(Character.toLowerCase((char) this.level.charAt(0)));
    113 
    114117        int c, w;
    115118        w = 0;
    116119        c = 0;
    117         while (c < this.field.length() && w < 2) {
    118         char ch = this.field.charAt(c);
    119 
     120        while (c < field_string.length() && w < 2) {
     121        char ch = field_string.charAt(c);
     122       
    120123        ch = Character.toLowerCase(ch);
    121124        if (Character.isLetter(ch)) {
     
    130133        this.name = new_name.toString();
    131134    }
     135
     136   
     137    public String getLevel()
     138    {
     139        return this.level;
     140    }
     141
     142    public List getFields()
     143    {
     144        return this.fields;
     145    }
     146
     147    public String getName()
     148    {
     149//      if (this.name==null || this.name.equals("")) {
     150//      createIndexName();
     151//      }
     152        return this.name;
     153    }
     154
     155    public boolean hasError() {
     156        return this.error;
     157    }
     158    public void setError(boolean b) {
     159        this.error = b;
     160    }
     161
     162//  private void createIndexName() {
     163//      StringBuffer new_name = new StringBuffer();
     164//      new_name.append(Character.toLowerCase((char) this.level.charAt(0)));
     165
     166//      int c, w;
     167//      w = 0;
     168//      c = 0;
     169//      String [] fields_concat = this.fields.toArray
     170//      while (c < this.field.length() && w < 2) {
     171//      char ch = this.field.charAt(c);
     172
     173//      ch = Character.toLowerCase(ch);
     174//      if (Character.isLetter(ch)) {
     175//          if (ch != 'a' && ch != 'e' && ch != 'i' &&
     176//          ch != 'o' && ch != 'u') {
     177//          new_name.append(ch);
     178//          w++;
     179//          }
     180//      }
     181//      c ++;
     182//      }
     183//      this.name = new_name.toString();
     184//  }
     185 
     186
    132187    } // MGIndex
    133188
     
    147202    return this.overallName;
    148203    }
    149 
    150     //    private String getIndexDirectory(String level, String field)
    151     //    { StringBuffer directory = new StringBuffer();
    152     //      directory.append(Character.toLowerCase((char) level.charAt(0)));
    153 
    154     //      int c, w;
    155     //      w = 0;
    156     //      c = 0;
    157     //      while (c < field.length() && w < 2) {
    158     //        char ch = field.charAt(c);
    159 
    160     //        ch = Character.toLowerCase(ch);
    161     //        if (Character.isLetter(ch)) {
    162     //      if (ch != 'a' && ch != 'e' && ch != 'i' &&
    163     //          ch != 'o' && ch != 'u') {
    164     //        directory.append(ch);
    165     //        w++;
    166     //      }
    167     //        }
    168     //        c ++;
    169     //      }
    170     //      return directory.toString();
    171     //    }
     204   
     205    public boolean configure(Node search_node)
     206    {
     207    NodeList index_children = GSXML.getChildrenByTagName(search_node, GSXML.INDEX_ELEM);
     208   
     209    // add a text 'index' - we should be able to turn this off in the config file? actually mg needs a text index
     210    ArrayList list = new ArrayList();
     211    list.add("text");
     212    MGIndex index = new MGIndex("text", "section", list);
     213    indexes.add(index);
     214    for (int i = 0; i < index_children.getLength(); i ++) {
     215        Element index_elem = (Element)index_children.item(i);
     216        index = new MGIndex(index_elem);
     217        if (index.getName() != null && index.getLevel() != null && index.getFields()!= null) {
     218       
     219        indexes.add(index);
     220        } else {
     221        System.err.println("invalid index spec, not including"+new XMLConverter().getPrettyString(index_elem));
     222        }
     223    }
     224    // TODO make sure all index names are unique
     225    return true;
     226    }
    172227
    173228    /**
     
    206261    }
    207262
    208     public boolean addIndex(String name, String level, String field)
    209     {
    210     MGIndex index = new MGIndex(name, level, field);
    211     this.indexes.add(index);
    212     return true;
    213     }
    214263
    215264    private Node recurseDOM(DocumentInterface metsDoc, Node node,
     
    218267    //String name, String namespace, String field)
    219268    {
     269    List fields = current_index.getFields();
    220270    // send out the ctrl-c...if this is
    221271    if (structure.getStructureType().equals(METSDivision.DIVISION_TYPE)) {
    222272        // try doing this for all index types
    223         if ((this.currentIndexName != null)) { // && this.level != null && this.level.equals(IndexerInterface.SECTION_LEVEL)) { //name.startsWith("s")) {
     273        // actually we should only need to do this once ????
     274        if (this.pass == 0) {
     275        //if ((this.currentIndexName != null)) { // && this.level != null && this.level.equals(IndexerInterface.SECTION_LEVEL)) { //name.startsWith("s")) {
    224276        METSDivision division = (METSDivision) structure;
    225277
     
    251303        // by an end of document character.  This ensures that all indexes use the
    252304        // same document numbering...
    253         if (this.currentIndexLevel == null ||
    254         this.currentIndexLevel.equals(IndexerInterface.DOCUMENT_LEVEL)) {
     305        if (this.current_index.getLevel().equals(IndexerInterface.DOCUMENT_LEVEL)) {
    255306        extraBuffer.append(END_OF_DOCUMENT);
    256307        }
     
    259310        this.documentSeqNo ++;
    260311        }
    261    
     312       
    262313        // produce the body here for metadata output of divisions - in the case of
    263314        // text output, that will happen below...
    264         if (!this.currentIndexField.equals("text")) {
     315       
     316        if (fields.size()>1 || !((String)fields.get(0)).equals("text")) {
     317        // if there is only text, don't do this
    265318        METSDescriptive descriptive;
    266319   
     
    268321
    269322        String metadataId = division.getDefaultMetadataReference();
    270        
     323        // are there other metadata refs to get??
    271324        descriptive = metsDoc.getDocumentMetadata().getDescriptiveById(metadataId);
    272325        if (descriptive != null) {
    273             List values = descriptive.getMetadata(namespace, this.currentIndexField);
    274      
    275             if (values != null) {   
    276             Iterator valueIter = values.iterator();
    277             while (valueIter.hasNext()) {
    278                 String value = valueIter.next().toString();
    279          
    280                 textBuffer.append(value);
    281                 if (valueIter.hasNext()) {
    282                 //textBuffer.append(END_OF_SECTION);
     326            for (int i=0; i<fields.size(); i++) {
     327            String field = (String)fields.get(i);
     328            if (field.equals("text")) {
     329                continue;
     330            }
     331            List values = descriptive.getMetadata(namespace, field);
     332            if (values != null) {   
     333                Iterator valueIter = values.iterator();
     334                while (valueIter.hasNext()) {
     335                String value = valueIter.next().toString();
     336                textBuffer.append(value);
     337                textBuffer.append(" ");
    283338                }
    284339            }
     
    287342        }
    288343    }
    289 
     344   
    290345    // go through our children as required...
    291346    Iterator children = structure.getChildIterator();
    292347    Node startNode;
     348    boolean index_text = fields.contains("text");
    293349    while (children.hasNext()) {
    294350        AbstractStructure child = (AbstractStructure) children.next();
     
    301357        startNode = ((HTMLDocument) metsDoc).getSectionStartNode((METSDivision) child);
    302358        }
    303         //Node startNode = ((HTMLDocument) metsDoc).getSectionStartNode((METSDivision) child);
    304      
    305         // while this node isn't the child's start node, produce the HTML node text, if
    306         // in text field mode...
    307         if (this.currentIndexField.equals("text")) {
     359       
     360        // while this node isn't the child's start node, produce the
     361        // HTML node text, if in text field mode...
     362        if (index_text) {
    308363        while (node != startNode) {
    309364            XPointer.printNode(node, textBuffer, false);
    310 
    311             // print buffer to node
    312             node = XPointer.getNextNode(node, (this.currentIndexField.equals("text") ? textBuffer : null));
    313         }
    314         }
    315      
     365            node = XPointer.getNextNode(node);
     366        }
     367        }
     368       
    316369        // recurse to child
    317370        node = this.recurseDOM(metsDoc, node, child, textBuffer, extraBuffer, namespace); // name, namespace, field);
     
    320373    // close a document - the actual closing \B will be done by the main
    321374    // loop, so only a required \C is printed here...
     375    // why have we got STRUCTURE_TYPE here and DIVISION_TYPE above????
    322376    if (structure.getStructureType().equals(METSStructure.STRUCTURE_TYPE)) {
    323         while (node != null) {
    324         if (this.currentIndexField.equals("text")) {
     377        if (index_text) {
     378        while (node != null) {
    325379            XPointer.printNode(node, textBuffer, false);
    326         }
    327         node = XPointer.getNextNode(node, (this.currentIndexField.equals("text") ? textBuffer : null));
     380            node = XPointer.getNextNode(node);
     381        }
    328382        }
    329383     
     
    354408    public boolean indexDocument(DocumentID docID, DocumentInterface document)
    355409    {
    356     if (this.pass == 0) {
    357         document.removeAllMetadata("gsdl3", "mgseqno");
    358     }
    359410   
    360411    if (!this.firstDocument) {
     
    366417
    367418    String docText = null;
    368    
    369     int startSeqNo = this.sectionSeqNo;
     419    // set the mgseqno if first pass
     420    if (this.pass == 0) {
     421        document.removeAllMetadata("gsdl3", "mgseqno");
     422        document.addDocumentMetadata("gsdl3", "mgseqno", this.overallName+"."+Integer.toString(this.sectionSeqNo));
     423    }
     424
    370425    this.sectionSeqNo ++;
    371426   
     427    //long start = System.currentTimeMillis();
    372428    Document domDocument = document.getDOMDocument();
    373429    if (domDocument != null) {
     
    380436        }
    381437    }
     438    //long finish = System.currentTimeMillis();
     439    //System.err.println("dom doc = "+ Long.toString(finish-start));
     440    //start = System.currentTimeMillis();
    382441    if (docText == null) {
    383442        System.err.println("dom doc or sections was null - asking for doc text");
    384         if (this.currentIndexField.equals("text")) {
    385         //docText = Character.toString(END_OF_DOCUMENT) + document.getDocumentText();
    386         docText = document.getDocumentText();
    387         }
    388         else {
    389         StringBuffer textBuffer = new StringBuffer();
    390         //textBuffer.append(END_OF_DOCUMENT);
    391         List values = document.getDocumentMetadataItem("gsdl3", this.currentIndexField);
    392         if (values != null) {
    393             Iterator valueIter = values.iterator();
    394             while (valueIter.hasNext()) {
    395             String value = valueIter.next().toString();
    396            
    397             textBuffer.append(value);
    398             if (valueIter.hasNext()) {
    399                 //textBuffer.append(END_OF_SECTION);
    400                 //        sectionSeqNo ++;
     443        StringBuffer doc_text_buffer = new StringBuffer();
     444        List fields = this.current_index.getFields();
     445        for (int i=0; i<fields.size(); i++) {
     446        String field = (String)fields.get(i);
     447        if (field.equals("text")) {
     448            doc_text_buffer.append(document.getDocumentText());
     449        }  else {
     450            // its a metadata - do namespace properly!!
     451            List values = document.getDocumentMetadataItem("gsdl3", field);
     452            if (values != null) {
     453            Iterator valueIter = values.iterator();
     454            while (valueIter.hasNext()) {
     455                String value = valueIter.next().toString();
     456                doc_text_buffer.append(value);
    401457            }
    402458            }
    403459        }
    404         else {
    405             textBuffer.append("No data");
    406         }
    407         docText = textBuffer.toString();
    408         }
     460        } // for each field
     461        docText = doc_text_buffer.toString();
    409462        sectionSeqNo ++;
    410463    }
    411    
     464    //finish = System.currentTimeMillis();
     465    //System.err.println("whole doc = "+ Long.toString(finish-start));
    412466   
    413467    this.indexBuffer.append(docText);
    414468    // remember that we're not on the first document,
    415469    this.firstDocument = false;
    416     // assign the sequence number on the first pass only, and increment the sequence number.
    417     if (this.pass == 0) {
    418         document.addDocumentMetadata("gsdl3", "mgseqno", this.overallName+"."+Integer.toString(startSeqNo));
    419     }
    420     this.documentSeqNo += 1;
     470    this.documentSeqNo ++;
    421471
    422472    return true;
     
    436486    this.mgPasses = new MGPassesWrapper();
    437487    this.indexBuffer = new StringBuffer();
    438     int indexNo = (this.pass - 2) / 2;
    439     MGIndex index = null;
    440     if (this.pass >= 2) {
    441         index = (MGIndex) this.indexes.get(indexNo);
    442         if (index.hasError()) {
    443         // an error has already occurred for this index, don't continue
    444         System.out.println("pass "+this.pass+": aborted due to errors in the previous pass");
    445         return false;
    446         }
    447         // attempt to ensure that the text subdirectory exists
    448         this.indexDirectory = new File(outputDirectory, index.getName());
    449         if (!indexDirectory.exists()) {
    450         if (!indexDirectory.mkdir()) {
    451             return false;
    452         }
    453         }
    454         else if (!indexDirectory.isDirectory()) {
    455         return false;
    456         }
    457        
    458         this.currentIndexLevel = index.getLevel();
    459         this.currentIndexField = index.getField();
    460         this.currentIndexName = index.getName();
    461        
    462         if (this.currentIndexLevel == null || this.currentIndexField == null ) {
    463         System.out.println("invalid index - level or field was null");
    464         return false;
    465         }
    466         this.indexStem = this.indexDirectory.getPath() + File.separatorChar + INDEX_FILE_STEM;  // TODO: modify for index
    467         if (this.pass % 2 == 1) {
    468         this.currentIndexName = null; // why???
    469         }
    470     }
    471     else {
    472        
    473         this.currentIndexField = "text";
    474         this.currentIndexLevel = "section";
    475         this.currentIndexName = null;
    476     }
    477    
    478     // get the parameters for this execution of mg_passes
    479     mgPasses.setFileName((this.pass < 2 ? this.textDirectory.toString() : this.indexDirectory.toString())+File.separator+ "index");
     488    int indexNo = this.pass/2;
     489    this.current_index = null;
     490   
     491    this.current_index = (MGIndex) this.indexes.get(indexNo);
     492    if (this.current_index.hasError()) {
     493        // an error has already occurred for this index, don't continue
     494        System.out.println("pass "+this.pass+": aborted due to errors in the previous pass");
     495        return false;
     496    }
     497    // attempt to ensure that the text/index subdirectory exists
     498    this.indexDirectory = new File(outputDirectory, current_index.getName());
     499    if (!indexDirectory.exists()) {
     500        if (!indexDirectory.mkdir()) {
     501        return false;
     502        }
     503    }
     504    else if (!indexDirectory.isDirectory()) {
     505        return false;
     506    }
     507
     508    this.indexStem = this.indexDirectory.getPath() + File.separatorChar + INDEX_FILE_STEM;  // TODO: modify for index
     509    if (this.pass == 0) {
     510        // first pass, also set up the textStem
     511        this.textDirectory = this.indexDirectory;
     512        this.textStem = this.indexStem;
     513    }
     514    mgPasses.setFileName(this.indexStem);
    480515    if (!Misc.isWindows()) {
    481516        mgPasses.setBasePath("/");
     
    516551   
    517552    mgPasses.init();
    518     System.out.println("Pass " + this.pass);
     553    System.out.println("Starting Pass " + this.pass);
    519554    return true;
    520555    }
     
    524559     */
    525560    public boolean endPass(int passNumber) {
    526     Process p;
    527    
    528     int indexNo = (passNumber - 2) / 2;
    529     MGIndex index = null;
    530     if (passNumber >= 2) {
    531         index = (MGIndex) this.indexes.get(indexNo);
    532     }
    533561    try {
    534562        this.indexBuffer.append(END_OF_DOCUMENT);
     
    549577    if (exit_value !=0) {
    550578        //assume something has gone wrong, don't continue
    551         if (index != null) {
    552         index.setError(true);
    553         return false;
    554         }
     579        current_index.setError(true);
     580        return false;
    555581    }
    556582    int mgPass = this.pass < 2 ? this.pass : ((this.pass % 2) + 2);
     
    559585        osextra = " -d / ";
    560586    }
    561 
     587   
    562588    switch (mgPass) {
    563589       
    564590    case 0:
    565591        System.out.println("Compressing dictionary");
    566         exit_value = Processing.runProcess("mg_compression_dict -f " + this.textDirectory.toString()+File.separator+"index" + osextra + " -S -H -2 -k 5120");
     592        exit_value = Processing.runProcess("mg_compression_dict -f " + this.textStem + osextra + " -S -H -2 -k 5120");
    567593        if (exit_value == 0) {
    568594        System.out.println("Compressed dictionary successfully written");
    569595        } else {
    570596        System.err.println("Error from mg_compression_dict: " + exit_value);
    571         index.setError(true);
     597        current_index.setError(true);
    572598       
    573599        return false;
     
    577603    case 2:
    578604        System.out.println("Creating perfect hash");
    579         exit_value = Processing.runProcess("mg_perf_hash_build -f " + this.indexDirectory.toString()+File.separator+ "index"+osextra);
     605        exit_value = Processing.runProcess("mg_perf_hash_build -f " + this.indexStem+osextra);
    580606        if (exit_value ==0) {
    581607        System.out.println("Perfect hashes completed");
    582608        } else {
    583609        System.err.println("Unable to build the perfect hash");
    584         index.setError(true);
     610        current_index.setError(true);
    585611        return false;
    586612        }
     
    594620        } else {
    595621        System.err.println("Unable to create weights file");
    596         index.setError(true);
     622        current_index.setError(true);
    597623        return false;
    598624        }
    599625       
    600626        System.out.println("Creating inverted dictionary");
    601         exit_value = Processing.runProcess("mg_invf_dict -f " + this.indexDirectory.toString()+File.separator+"index" + osextra);
     627        exit_value = Processing.runProcess("mg_invf_dict -f " + this.indexStem + osextra);
    602628        if (exit_value ==0) {
    603629        System.out.println("Inverted dictionary file successfully written");
    604630        } else {
    605631        System.out.println("Unable to create inverted dictionary file");
    606         index.setError(true);
     632        current_index.setError(true);
    607633        return false;
    608634        }
    609635       
    610636        System.out.println("Creating Stem indexes");
    611         exit_value = Processing.runProcess("mg_stem_idx -b 4096 -s1 -f " + this.indexDirectory.toString()+File.separator+"index"+osextra);
     637        exit_value = Processing.runProcess("mg_stem_idx -b 4096 -s1 -f " + this.indexStem+osextra);
    612638        if (exit_value == 0) {
    613639        System.out.println("Stemmed index 1 successfully written");
    614640        } else {
    615641        System.out.println("Unable to create stemmed index 1");
    616         index.setError(true);
    617         return false;
    618         }
    619        
    620         exit_value = Processing.runProcess("mg_stem_idx -b 4096 -s2 -f " + this.indexDirectory.toString()+File.separator+"index"+osextra);
     642        current_index.setError(true);
     643        return false;
     644        }
     645       
     646        exit_value = Processing.runProcess("mg_stem_idx -b 4096 -s2 -f " + this.indexStem+osextra);
    621647        if (exit_value == 0) {
    622648        System.out.println("Stemmed index 2 successfully written");
    623649        } else {
    624650        System.out.println("Unable to create stemmed index 2");
    625         index.setError(true);
    626         return false;
    627         }
    628         exit_value = Processing.runProcess("mg_stem_idx -b 4096 -s3 -f " + this.indexDirectory.toString()+File.separator+"index"+osextra);
     651        current_index.setError(true);
     652        return false;
     653        }
     654        exit_value = Processing.runProcess("mg_stem_idx -b 4096 -s3 -f " + this.indexStem+osextra);
    629655        if (exit_value == 0) {
    630656        System.out.println("Stemmed index 3 successfully written");
    631657        } else {
    632658        System.out.println("Unable to create stemmed index 3");
    633         index.setError(true);
     659        current_index.setError(true);
    634660        return false;
    635661        }
     
    654680    public int getNumberOfPasses()
    655681    {
    656     return 2 + this.indexes.size() * 2;
     682    //return 2 + this.indexes.size() * 2;
     683    return this.indexes.size()*2;
    657684    }
    658685
     
    665692    boolean found_index = false;
    666693    String def_index = ""; // the default index will just be the first one created for now.
    667     for (int i=0; i<this.indexes.size(); i++) {
     694    for (int i=1; i<this.indexes.size(); i++) {
     695        // start at 1: 0 will be the text index
    668696        MGIndex index = (MGIndex)this.indexes.get(i);
    669697        if (!index.hasError()) {
     
    688716    base_index_name.setAttribute(GSXML.NAME_ATT, overallName);
    689717    Element index_stem = doc.createElement("indexStem");
    690     index_stem.setAttribute(GSXML.NAME_ATT, "index");
     718    index_stem.setAttribute(GSXML.NAME_ATT, INDEX_FILE_STEM);
    691719   
    692720    Element search_service_elem = doc.createElement(GSXML.SERVICE_CLASS_ELEM);
Note: See TracChangeset for help on using the changeset viewer.