Search in sources :

Example 1 with EntryBuilderService

use of org.nextprot.api.core.service.EntryBuilderService in project nextprot-api by calipho-sib.

the class GenerateSolrAnnotationIndexGold method start.

@Override
public void start(String[] args) {
    MasterIdentifierService MasterEntryService = getBean(MasterIdentifierService.class);
    EntryBuilderService entryBuilderService = getBean(EntryBuilderService.class);
    int ecnt = 0;
    String solrServer = System.getProperty("solr.server");
    NPreconditions.checkNotNull(solrServer, "Please set solr.server variable. For example: java -Dsolr.server=\"http://localhost:8983/solr/npentries1gold\"");
    logger.info("Solr server: " + solrServer);
    EntryGoldSolrIndexer indexer = new EntryGoldSolrIndexer(solrServer);
    // Get an access to some needed services
    indexer.setTerminologyservice(getBean(TerminologyService.class));
    indexer.setEntryBuilderService(getBean(EntryBuilderService.class));
    // Remove previous indexes
    logger.info("removing all solr entries records");
    indexer.clearDatabase("");
    Set<String> allentryids;
    System.err.println("getting all entries from API");
    logger.info("getting all entries from API");
    long start = System.currentTimeMillis();
    allentryids = MasterEntryService.findUniqueNames();
    System.err.println("indexing " + allentryids.size() + " entries...");
    logger.info("indexing " + allentryids.size() + " entries...");
    for (String id : allentryids) {
        ecnt++;
        Entry currentry = entryBuilderService.buildWithEverything(id);
        indexer.add(currentry);
        if ((ecnt % 1000) == 0)
            logger.info(ecnt + " entries GOLD-indexed...");
    }
    indexer.addRemaing();
    logger.info("comitting");
    indexer.commit();
    logger.info(ecnt + " entries GOLD-indexed in " + (System.currentTimeMillis() - start) / 1000 + " seconds...END");
}
Also used : Entry(org.nextprot.api.core.domain.Entry) EntryBuilderService(org.nextprot.api.core.service.EntryBuilderService) TerminologyService(org.nextprot.api.core.service.TerminologyService) MasterIdentifierService(org.nextprot.api.core.service.MasterIdentifierService) EntryGoldSolrIndexer(org.nextprot.api.tasks.solr.indexer.EntryGoldSolrIndexer)

Aggregations

Entry (org.nextprot.api.core.domain.Entry)1 EntryBuilderService (org.nextprot.api.core.service.EntryBuilderService)1 MasterIdentifierService (org.nextprot.api.core.service.MasterIdentifierService)1 TerminologyService (org.nextprot.api.core.service.TerminologyService)1 EntryGoldSolrIndexer (org.nextprot.api.tasks.solr.indexer.EntryGoldSolrIndexer)1