簡體   English   中英

從碼頭開始Solr

[英]Start Solr with jetty

我有一個示例代碼java,可以使用Solr搜索索引的數據。

public class SimpleSolr 
{
    public static void main(String[] args) throws MalformedURLException, SolrServerException 
    {
      HttpSolrServer solr = new HttpSolrServer("http://localhost:8983/solr");

      // http://localhost:8983/solr/spellCheckCompRH?q=epod&spellcheck=on&spellcheck.build=true
      ModifiableSolrParams params = new ModifiableSolrParams();
      params.set("qt", "/select");
      params.set("q", "international");
      params.set("wt", "xml");
      //params.set("spellcheck.build", "true");

      QueryResponse response = solr.query(params);
      System.out.println("response = " + response);
  }
}

但是在執行此客戶端應用程序之前,我需要使用此命令啟動我的solr

java -jar start.jar

我需要自動啟動Solr服務器。

我怎樣才能做到這一點?

我需要知道從C ++應用程序與Solr服務器通信的bset方法是什么?

謝謝。

要在引導時運行solr服務器,您可能需要看一下以下線程: https : //superuser.com/questions/685471/how-can-i-run-a-command-after-boot

要從C ++應用程序與Solr服務器通信,最簡單的方法是通過在查詢中添加&wt=json來使用服務器的json API。

http://localhost:8983/solr/your_core/select?q={!dismax}&wt=json&indent=true

然后,您可以使用出色的JsonCPP( https://github.com/open-source-parsers/jsoncpp )解析收到的json。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM