Solrjを使用して、特にSolrインデックスに接続しようとしていEmbeddedSolrServer
ます。私のsolr.xml
見た目は次のようになります:
<solr>
<cores adminPath="/admin/cores" defaultCoreName="db">
<core default="true" instanceDir="../db/" name="db"/>
</cores>
</solr>
サーバーに対してクエリコマンドを実行する場合
CoreContainer coreContainer = new CoreContainer("C:\\development\\solr-4.4.0\\example tasks\\solr");
EmbeddedSolrServer server = new EmbeddedSolrServer(coreContainer, "db");
Collection<SolrCore> cores = coreContainer.getCores();
System.out.println(cores);
SolrQuery query = new SolrQuery();
query.setQuery("*:*");
query.addFacetField("taskType", "taskName");
QueryResponse rsp = server.query(query);
次の例外が発生します。
Exception in thread "main" org.apache.solr.common.SolrException: No such core: db
コアはそこにあり、 Jetty と同じファイルdb
を使用して Solr を起動すると、すべてが完璧に機能します。solr.xml