Changeset 6736
- Timestamp:
- 2004-02-05T12:05:50+13:00 (19 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers/IndexerInterface.java
r6349 r6736 12 12 public static final String GS2_INDEX_LABEL = "Index"; 13 13 14 public String getIndexType(); 15 public String getName(); 16 public int getNumberOfPasses(); 17 // TODO: add a function call to provide appropriate XML for the service description 18 public void tidyup(); 19 14 20 public boolean configure(String label, String value); 15 public boolean addIndex(String level, String field); 21 public boolean configure(org.w3c.dom.Node node); 22 public boolean addIndex(String name, String level, String field); 23 16 24 public boolean startPass(int passNumber); 17 25 public boolean indexDocument(DocumentID id, DocumentInterface document); 18 26 public boolean endPass(int passNumber); 19 public void tidyup(); 20 public int getNumberOfPasses(); 27 21 28 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers/MGIndexer.java
r6698 r6736 18 18 import org.greenstone.gsdl3.gs3build.xpointer.XPointer; 19 19 20 public class MGIndexer implements IndexerInterface20 public class MGIndexer extends AbstractIndexer 21 21 { 22 22 int pass; … … 37 37 String level; 38 38 String field; 39 String name; 39 40 40 41 static final char END_OF_DOCUMENT = (char) 2; … … 42 43 static final char END_OF_STREAM = (char) 4; 43 44 45 public static final String MG_INDEX_TYPE = "mg"; 46 44 47 class MGIndex 45 { String level; 48 { String name; 49 String level; 46 50 String field; 47 51 48 public MGIndex(String level, String field) 49 { this.level = level; 52 public MGIndex(String name, String level, String field) 53 { this.name = name; 54 this.level = level; 50 55 this.field = field; 51 56 } … … 55 60 56 61 if (colonAt >= 0) 57 { field = indexLabel.substring(colonAt+1); 58 level = indexLabel.substring(0, colonAt); 59 } 62 { this.field = indexLabel.substring(colonAt+1); 63 this.level = indexLabel.substring(0, colonAt); 64 } 65 this.name = null; 60 66 } 61 67 … … 67 73 { return this.field; 68 74 } 69 } 70 71 public MGIndexer() 75 76 public String getName() 77 { return this.name; 78 } 79 } 80 81 public MGIndexer(String name) 72 82 { this.indexes = new ArrayList(); 83 this.name = name; 84 } 85 86 public String getIndexType() 87 { return MG_INDEX_TYPE; 88 } 89 90 public String getName() 91 { return this.name; 73 92 } 74 93 … … 131 150 } 132 151 133 public boolean addIndex(String level, String field)152 public boolean addIndex(String name, String level, String field) 134 153 { 135 MGIndex index = new MGIndex( level, field);154 MGIndex index = new MGIndex(name, level, field); 136 155 this.indexes.add(index); 137 156 return true; … … 160 179 } 161 180 162 descriptive. setMetadata("gsdl3", "mgseqno", indexName + "." + Integer.toString(this.sectionSeqNo));181 descriptive.addMetadata("gsdl3", "mgseqno", indexName + "." + Integer.toString(this.sectionSeqNo)); 163 182 metsDoc.setModified(true); 164 183 // System.out.println("Assigning " + this.sectionSeqNo + " to " + metsDoc.getID() + " " + division.getLabel()); … … 269 288 public boolean indexDocument(DocumentID docID, DocumentInterface document) 270 289 { 290 if (this.pass == 0) { 291 document.removeAllMetadata("gsdl3", "mgseqno"); 292 } 293 271 294 if (!this.firstDocument) 272 295 { // Send a 'CTRL-B' before the document itself … … 280 303 } 281 304 } 305 282 306 String docText = null; 283 307 … … 421 445 this.level = index.getLevel(); 422 446 this.field = index.getField(); 423 this.indexName = this.getIndexDirectory(index.getLevel(), index.getField()); 447 this.indexName = index.getName(); 448 if (this.indexName == null || this.indexName.length() == 0) { 449 this.indexName = this.getIndexDirectory(index.getLevel(), index.getField()); 450 } 424 451 this.indexStem = this.outputDirectory + File.separatorChar + 425 452 this.indexName + File.separatorChar + "index"; // TODO: modify for index -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers/MGPPIndexer.java
r6349 r6736 8 8 import java.io.IOException; 9 9 10 public class MGPPIndexer implements IndexerInterface10 public class MGPPIndexer extends AbstractIndexer 11 11 { 12 12 int pass; 13 String name; 13 14 boolean firstDocument; 14 15 String outputDirectory; … … 19 20 Process mgpp_passes; 20 21 static final String documentSeparator = "<Document>"; 22 23 public static final String MGPP_INDEX_TYPE = "mgpp"; 21 24 22 public MGPPIndexer() 23 { 25 public MGPPIndexer(String name) 26 { this.name = name; 27 } 28 29 public String getName() 30 { return this.name; 24 31 } 25 32 … … 38 45 } 39 46 40 public boolean addIndex(String level, String field) 47 public String getIndexType() 48 { return MGPP_INDEX_TYPE; 49 } 50 51 public boolean addIndex(String name, String level, String field) 41 52 { return true; 42 53 }
Note:
See TracChangeset
for help on using the changeset viewer.