Example #1
0
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    lilyProxy = new LilyProxy();

    InputStream is = BatchBuildTest.class.getResourceAsStream("solrschema.xml");
    byte[] solrSchema = IOUtils.toByteArray(is);
    IOUtils.closeQuietly(is);

    lilyProxy.start(solrSchema);

    solrProxy = lilyProxy.getSolrProxy();
    solrServer = solrProxy.getSolrServer();
    lilyServerProxy = lilyProxy.getLilyServerProxy();
    lilyClient = lilyServerProxy.getClient();
    repository = lilyClient.getRepository();

    typeManager = repository.getTypeManager();
    FieldType ft1 =
        typeManager.createFieldType(
            "STRING", new QName("batchindex-test", "field1"), Scope.NON_VERSIONED);
    FieldType ft2 =
        typeManager.createFieldType(
            "LINK", new QName("batchindex-test", "linkField"), Scope.NON_VERSIONED);
    typeManager
        .recordTypeBuilder()
        .defaultNamespace("batchindex-test")
        .name("rt1")
        .fieldEntry()
        .use(ft1)
        .add()
        .fieldEntry()
        .use(ft2)
        .add()
        .create();

    model = lilyServerProxy.getIndexerModel();

    is = BatchBuildTest.class.getResourceAsStream("indexerconf.xml");
    byte[] indexerConfiguration = IOUtils.toByteArray(is);
    IOUtils.closeQuietly(is);

    IndexDefinition index = model.newIndex(INDEX_NAME);
    Map<String, String> solrShards = new HashMap<String, String>();
    solrShards.put("shard1", "http://localhost:8983/solr");
    index.setSolrShards(solrShards);
    index.setConfiguration(indexerConfiguration);
    index.setUpdateState(IndexUpdateState.DO_NOT_SUBSCRIBE);
    model.addIndex(index);
  }
Example #2
0
 private void buildAndCommit() throws Exception {
   lilyServerProxy.batchBuildIndex(INDEX_NAME, BUILD_TIMEOUT);
   solrServer.commit();
 }