本文整理匯總了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);
}
示例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);
}
示例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();
}
}