/** * {@inheritDoc} */ public void close() { if (index != null) { index.setIndexProperty("num"+midfix+".Terms", ""+numberOfTerms); index.setIndexProperty("num"+midfix+".Tokens", ""+numberOfTokens); index.setIndexProperty("num"+midfix+".Pointers", ""+numberOfPointers); } } }
"org.terrier.structures.IndexOnDisk,java.lang.String,java.util.Iterator", "index,structureName,"+pointerSourceStreamStructureName); index.setIndexProperty("index."+this.structureName+".fields.count", String.valueOf(this.fieldCount)); index.setIndexProperty("index."+this.structureName+".fields.names", ArrayUtils.join(this.fieldNames, ",")); index.setIndexProperty("index."+this.structureName+".blocks", String.valueOf(this.hasBlocks)); index.setIndexProperty("index."+this.structureName+".blocks.max", String.valueOf(this.maxBlocks)); if (this.hasBlocks > 0) index.setIndexProperty(k, v);
"org.terrier.structures.IndexOnDisk,java.lang.String,java.util.Iterator", "index,structureName,"+pointerSourceStreamStructureName); index.setIndexProperty("index."+this.structureName+".fields.count", String.valueOf(this.fieldCount)); index.setIndexProperty("index."+this.structureName+".fields.names", ArrayUtils.join(this.fieldNames, ",")); index.setIndexProperty("index."+this.structureName+".blocks", String.valueOf(this.hasBlocks)); index.setIndexProperty("index."+this.structureName+".blocks.max", String.valueOf(this.maxBlocks)); if (this.hasBlocks > 0) index.setIndexProperty(k, v);
/** Update the index's properties for this structure */ public void writeIndexProperties(Index index, String pointerSourceStream) { index.addIndexStructure( this.structureName, this.getStructureClass().getName(), "org.terrier.structures.IndexOnDisk,java.lang.String,java.lang.Class", "index,structureName,"+ this.getPostingIteratorClass().getName() ); index.addIndexStructureInputStream( this.structureName, this.getStructureInputStreamClass().getName(), "org.terrier.structures.IndexOnDisk,java.lang.String,java.util.Iterator,java.lang.Class", "index,structureName,"+pointerSourceStream+","+ this.getPostingIteratorClass().getName() ); index.setIndexProperty("index."+this.structureName+".fields.count", String.valueOf(this.fieldCount)); index.setIndexProperty("index."+this.structureName+".fields.names", ArrayUtils.join(this.fieldNames, ",")); index.setIndexProperty("index."+this.structureName+".blocks", String.valueOf(this.hasBlocks)); index.setIndexProperty("index."+this.structureName+".blocks.max", String.valueOf(this.maxBlocks)); } }
sourceIndex.setIndexProperty((String)o, destProperties.getProperty(key, null));
sourceIndex.setIndexProperty((String)o, destProperties.getProperty(key, null));
protected Matching getMatching(String[] rows, String[] docnos) throws Exception { File tmpFile = folder.newFile("tmp.res"); Writer w = Files.writeFileWriter(tmpFile); for(String row : rows) w.append(row + "\n"); w.close(); Index index = Index.createNewIndex(folder.newFolder("index").toString(), "data"); index.setIndexProperty("num.Documents", ""+docnos.length); IndexUtil.forceStructure(index, "meta", new ArrayMetaIndex(docnos)); Matching rtr = new TRECResultsMatching(index, tmpFile.toString()); return rtr; }
@Test(expected=IllegalArgumentException.class) public void dirNotExists() throws Exception { Index newIndex = IndexOnDisk.createNewIndex(ApplicationSetup.TERRIER_INDEX_PATH + "/tmp/", "data"); newIndex.setIndexProperty("hello", "there"); newIndex.flush(); newIndex.close(); }