public static void createRandomIndex(int numdocs,RandomIndexWriter writer,long seed) throws IOException {
  Random random=new Random(seed);
  LineFileDocs lineFileDocs=new LineFileDocs(random);
  for (int i=0; i < numdocs; i++) {
    Document document=lineFileDocs.nextDoc();
    String title=document.get("titleTokenized");
    String split[]=title.split("\\s+");
    document.removeFields("sortedset");
    for (    String trash : split) {
      document.add(new SortedSetDocValuesField("sortedset",new BytesRef(trash)));
    }
    document.removeFields("sparsenumeric");
    if (random.nextInt(4) == 2) {
      document.add(new NumericDocValuesField("sparsenumeric",random.nextInt()));
    }
    document.removeFields("sparsesortednum");
    if (random.nextInt(5) == 1) {
      document.add(new SortedNumericDocValuesField("sparsesortednum",random.nextLong()));
      if (random.nextBoolean()) {
        document.add(new SortedNumericDocValuesField("sparsesortednum",random.nextLong()));
      }
    }
    writer.addDocument(document);
  }
  lineFileDocs.close();
}

public static void createRandomIndex ( int numdocs , RandomIndexWriter writer , long seed ) throws IOException { Random random = new Random ( seed ) ; LineFileDocs lineFileDocs = new LineFileDocs ( random ) ; for ( int i = 0 ; i < numdocs ; i ++ ) { Document document = lineFileDocs . nextDoc ( ) ; String title = document . get ( "titleTokenized" ) ; String split [ ] = title . split ( "\\s+" ) ; document . removeFields ( "sortedset" ) ; for ( String trash : split ) { document . add ( new SortedSetDocValuesField ( "sortedset" , new BytesRef ( trash ) ) ) ; } document . removeFields ( "sparsenumeric" ) ; if ( random . nextInt ( 4 ) == 2 ) { document . add ( new NumericDocValuesField ( "sparsenumeric" , random . nextInt ( ) ) ) ; } document . removeFields ( "sparsesortednum" ) ; if ( random . nextInt ( 5 ) == 1 ) { document . add ( new SortedNumericDocValuesField ( "sparsesortednum" , random . nextLong ( ) ) ) ; if ( random . nextBoolean ( ) ) { document . add ( new SortedNumericDocValuesField ( "sparsesortednum" , random . nextLong ( ) ) ) ; } } writer . addDocument ( document ) ; } lineFileDocs . close ( ) ; }
populates a writer with random stuff . this must be fully reproducable with the seed !
