/** tell the index about a new input stream index structure it provides. */ public void addIndexStructureInputStream(String structureName, Class<?> className, Class<?>[] paramTypes, String[] paramValues) { addIndexStructure(structureName + "-inputstream", className, paramTypes, paramValues); }
/** 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)); } }
/** tell the index about a new input stream index structure it provides. */ public void addIndexStructureInputStream(String structureName, String className, String paramTypes, String paramValues) { addIndexStructure(structureName + "-inputstream", className, paramTypes, paramValues); }
index.addIndexStructure("lexicon", "org.terrier.structures.FSOMapFileLexicon", new String[] { "java.lang.String", "org.terrier.structures.IndexOnDisk" }, new String[] { "structureName", "index" }); index.addIndexStructure("lexicon-keyfactory", "org.terrier.structures.seralization.FixedSizeTextFactory", new String[] { "java.lang.String" }, new String[] { "${max.term.length}" }); index.addIndexStructure("lexicon-valuefactory", "org.terrier.structures.FieldLexiconEntry$Factory", new String[] { "java.lang.String" }, new String[] { "${index.inverted.fields.count}" }); index.addIndexStructureInputStream("lexicon", "org.terrier.structures.FSOMapFileLexicon$MapFileLexiconIterator", new String[] { "java.lang.String", "org.terrier.structures.IndexOnDisk" }, new String[] { "structureName", "index" }); index.addIndexStructureInputStream("lexicon-entry", "org.terrier.structures.FSOMapFileLexicon$MapFileLexiconEntryIterator", new String[] { "java.lang.String", "org.terrier.structures.IndexOnDisk" }, new String[] { "structureName", "index" }); index.addIndexStructure("document", "org.terrier.structures.FSAFieldDocumentIndex", new String[] { "org.terrier.structures.IndexOnDisk", "java.lang.String" }, new String[] { "index", "structureName" }); index.addIndexStructure("document-factory", "org.terrier.structures.FieldDocumentIndexEntry$Factory", new String[] { "java.lang.String" }, new String[] { "${index.inverted.fields.count}" }); index.addIndexStructureInputStream("document", "org.terrier.structures.FSADocumentIndex$FSADocumentIndexIterator", new String[] { "org.terrier.structures.IndexOnDisk", "java.lang.String" }, new String[] { "index", "structureName" }); index.addIndexStructure("meta", "org.terrier.structures.CompressingMetaIndex", new String[] { "org.terrier.structures.IndexOnDisk", "java.lang.String" }, new String[] { "index", "structureName" }); index.addIndexStructureInputStream("meta", "org.terrier.structures.CompressingMetaIndex$InputStream", new String[] { "org.terrier.structures.IndexOnDisk", "java.lang.String" }, new String[] { "index", "structureName" });
/** tell the index about a new input stream index structure it provides. */ public void addIndexStructureInputStream(String structureName, String className, String paramTypes, String paramValues) { addIndexStructure(structureName + "-inputstream", className, paramTypes, paramValues); }
@Override public void writeIndexProperties(Index index, String pointerSourceStreamStructureName) index.addIndexStructure( this.structureName, this.getStructureClass().getName(),
/** tell the index about a new input stream index structure it provides. */ public void addIndexStructureInputStream(String structureName, String className) { addIndexStructure(structureName + "-inputstream", className); }
@Override public void writeIndexProperties(Index index, String pointerSourceStreamStructureName) index.addIndexStructure( this.structureName, this.getStructureClass().getName(),
/** tell the index about a new input stream index structure it provides. */ public void addIndexStructureInputStream(String structureName, String className, String[] paramTypes, String[] paramValues) { addIndexStructure(structureName + "-inputstream", className, paramTypes, paramValues); }
newIndex.addIndexStructure( "org.terrier.structures.IndexOnDisk" }, new String[] { "structureName", "index" }); newIndex.addIndexStructure( newIndex.addIndexStructure( newIndex.addIndexStructure( new String[] {}, new String[] {}); else newIndex.addIndexStructure( newIndex.addIndexStructure(
/** tell the index about a new input stream index structure it provides. */ public void addIndexStructureInputStream(String structureName, Class<?> className, Class<?>[] paramTypes, String[] paramValues) { addIndexStructure(structureName + "-inputstream", className, paramTypes, paramValues); }
/** tell the index about a new input stream index structure it provides. */ public void addIndexStructureInputStream(String structureName, String className, String[] paramTypes, String[] paramValues) { addIndexStructure(structureName + "-inputstream", className, paramTypes, paramValues); }
/** tell the index about a new input stream index structure it provides. */ public void addIndexStructureInputStream(String structureName, String className) { addIndexStructure(structureName + "-inputstream", className); }
/** * tell the index about a new index structure it provides. Class and * parameter types specified as Class objects instead of Strings. */ public void addIndexStructure(String structureName, Class<?> className, Class<?>[] paramTypes, String[] paramValues) { final int l = paramTypes.length; String[] SparamTypes = new String[l]; for (int i = 0; i < l; i++) SparamTypes[i] = paramTypes[i].getName(); addIndexStructure(structureName, className.getName(), SparamTypes, paramValues); }
/** * tell the index about a new index structure it provides. Class and * parameter types specified as Class objects instead of Strings. */ public void addIndexStructure(String structureName, Class<?> className, Class<?>[] paramTypes, String[] paramValues) { final int l = paramTypes.length; String[] SparamTypes = new String[l]; for (int i = 0; i < l; i++) SparamTypes[i] = paramTypes[i].getName(); addIndexStructure(structureName, className.getName(), SparamTypes, paramValues); }
static FixedSizeWriteableFactory<?> getKeyFactory(Index _index, String _structureName) throws IOException { _index.addIndexStructure(_structureName+"-keyfactory", org.terrier.structures.seralization.FixedSizeTextFactory.class.getName(), "java.lang.String", "${max.term.length}"); _index.flush(); return (FixedSizeWriteableFactory<?>)_index.getIndexStructure(_structureName+"-keyfactory"); }
static FixedSizeWriteableFactory<?> getKeyFactory(Index _index, String _structureName) throws IOException { _index.addIndexStructure(_structureName+"-keyfactory", org.terrier.structures.seralization.FixedSizeTextFactory.class.getName(), "java.lang.String", "${max.term.length}"); _index.flush(); return (FixedSizeWriteableFactory<?>)_index.getIndexStructure(_structureName+"-keyfactory"); }
@Test public void testCopyStructureSameIndex() throws Exception { Index i1 = Index.createNewIndex(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX + "i1"); i1.addIndexStructure("test1", Object.class.getName(), "", ""); IndexUtil.copyStructure(i1, i1, "test1", "test2"); assertEquals(Object.class, i1.getIndexStructure("test2").getClass()); }
@Test public void testCopyStructureDifferentIndex() throws Exception { Index i1 = Index.createNewIndex(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX + "i1"); Index i2 = Index.createNewIndex(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX + "i2"); i1.addIndexStructure("test1", Object.class.getName(), "", ""); IndexUtil.copyStructure(i1, i2, "test1", "test2"); assertEquals(Object.class, i2.getIndexStructure("test2").getClass()); }