當前位置: 首頁>>代碼示例>>Java>>正文


Java EmbeddedSolrServer.close方法代碼示例

本文整理匯總了Java中org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.close方法的典型用法代碼示例。如果您正苦於以下問題:Java EmbeddedSolrServer.close方法的具體用法?Java EmbeddedSolrServer.close怎麽用?Java EmbeddedSolrServer.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.solr.client.solrj.embedded.EmbeddedSolrServer的用法示例。


在下文中一共展示了EmbeddedSolrServer.close方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException, ParseException, JATEException {
    /*mergeGS("/home/zqz/Work/data/semeval2017-scienceie/scienceie2017_test/scienceie2017_test_gs",
            "/home/zqz/Work/data/semeval2017-scienceie/scienceie2017_test/all_key_phrases.txt");*/
    Lemmatiser lem = new Lemmatiser(new EngLemmatiser(args[0],
            false, false));
    String solrHomePath = args[4];
    String solrCoreName = args[5];
    final EmbeddedSolrServer solrServer = new EmbeddedSolrServer(Paths.get(solrHomePath), solrCoreName);
    JATEProperties jateProp = App.getJateProperties(args[6]);
    for (File f : new File(args[1]).listFiles()) {
        File outFolder = new File(args[2] + "/" + f.getName() + "/");
        outFolder.mkdirs();
        System.out.println(outFolder);

        transformToKEAOutput(f.toString(), 0, args[3], outFolder.toString(), lem,
                solrServer.getCoreContainer().getCore(solrCoreName), jateProp);
    }
    solrServer.close();
    System.exit(0);
}
 
開發者ID:ziqizhang,項目名稱:jate,代碼行數:21,代碼來源:ScienceIECorpusParser.java

示例2: validateSolrServerDocumentCount

import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer; //導入方法依賴的package包/類
public static void validateSolrServerDocumentCount(File solrHomeDir, FileSystem fs, Path outDir, int expectedDocs, int expectedShards)
    throws IOException, SolrServerException {
  
  long actualDocs = 0;
  int actualShards = 0;
  for (FileStatus dir : fs.listStatus(outDir)) { // for each shard
    if (dir.getPath().getName().startsWith("part") && dir.isDirectory()) {
      actualShards++;
      EmbeddedSolrServer solr = createEmbeddedSolrServer(
          solrHomeDir, fs, dir.getPath());
      
      try {
        SolrQuery query = new SolrQuery();
        query.setQuery("*:*");
        QueryResponse resp = solr.query(query);
        long numDocs = resp.getResults().getNumFound();
        actualDocs += numDocs;
      } finally {
        solr.close();
      }
    }
  }
  assertEquals(expectedShards, actualShards);
  assertEquals(expectedDocs, actualDocs);
}
 
開發者ID:NGDATA,項目名稱:hbase-indexer,代碼行數:26,代碼來源:TestUtils.java

示例3: restoreSolr5Index

import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer; //導入方法依賴的package包/類
/**
 * Performs Solr restoration.
 *
 * @param properties properties containing arguments to execute the restoration.
 */
private static void restoreSolr5Index (Properties properties) throws
      IOException, SolrServerException
{
   String solrHome = properties.getProperty ("dhus.solr.home");
   String coreName = properties.getProperty ("dhus.solr.core.name");
   final String name = properties.getProperty ("dhus.solr.backup.name");
   final String location = properties.getProperty (
         "dhus.solr.backup.location");

   if (solrHome == null || coreName == null || name == null ||
       location == null)
   {
      throw new UnsupportedOperationException ();
   }

   System.setProperty ("solr.solr.home", solrHome);
   CoreContainer core = new CoreContainer (solrHome);
   EmbeddedSolrServer server = new EmbeddedSolrServer (core, coreName);
   try
   {
      server.getCoreContainer ().load ();

      SolrQuery query = new SolrQuery();
      query.setRequestHandler("/replication");
      query.set("command", "restore");
      query.set("name", name);
      query.set("location", location);

      server.query(query);
      LOGGER.info("SolR indexes restored.");
   }
   finally
   {
      server.close();
   }
   
}
 
開發者ID:SentinelDataHub,項目名稱:dhus-core,代碼行數:43,代碼來源:SystemService.java


注:本文中的org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。